home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 May (DVD) / Macworld Resource DVD May 2003.toast / Data / Software / Feature / Internet and Networking / SnakUSEnglish.sit / Snak 4.9.2 / UserScripts / purepak.irc / purepak.irc
Encoding:
Text File  |  2002-12-16  |  106.2 KB  |  3,429 lines  |  [TEXT/R*ch]

  1.  
  2. # Snak adaptation 1.1. Removed handlers that emit conflicting messages and usually made '-'
  3. # Snak adaptation 1.2. Removed unnecessary checks for the correctness of ischanop
  4. # Snak adaptation 1.3. Removed pp.snm and calls to it as Snak does integrated highlighting
  5. # Snak adaptation 1.4. Removed pp.formecho in priv msg and notice handlers as it conflicts with normal message formatting
  6. #                       Removed //who when joining channel and message formatting in /who handler
  7. #                       Removed handlers for mesages 432 and 433 as Snak already does this
  8. #                       Removed message in notify_signon, and made it let Snak continue processing
  9. #                       Change order of handler and exec because execs are handled directly - not handed to the OS
  10. #                       The wait -CMD %<process> returns immediately as true
  11. #                       Removed CTCP handlers for ping, version, finger as Snak already does this
  12. #                       Modified dcc.ucmd.offer so that it asks properly for one or more files
  13. #                       dcc.ucmd.offer uses a variation on /input which asks for files
  14. #                       Because Mac files can contain spaces, the resulting list is separated by tabs, so 
  15. #                       a new function "listitem" is used instead of "word"
  16. #                      Removed fileexist from pp-dcc.irc alias and made a built in function
  17. #                       "Press ENTER to continue" in doechos removed..Snak can scoll.
  18. #                       /dcc save <file> saves package file in the scripts directory
  19. #                       /dcc notice now only sends to the current channel, not all channels.
  20. # Snak adaptation 1.5  the fileserver (/pphelp dcc) now works. Most changes consists of using listitem instead of word
  21. # Snak adaptation 1.6  Snak does its own DCC Autoaccept
  22. #                        Furthermore, the purepak dcc code does not always work because it assumes that there are no spaces 
  23. #                      in the filename. If there is then $6 will be incorrect and the script fails.
  24. # Snak adaptation 1.7  added special "window log_extrainfo off" flag to window creation so that Snaks text logger will
  25. #                       not write "server:" or "info:" before each line. This affects /sve and /dcc.ucmd.save
  26. #                       Removed Purepak 333 topic intercept as it interferes with Snak topic handling
  27. #                       Removed unnecessary (and incorrect) PurePak redefinition of the say alias
  28. # Snak adaptation 1.8  Snak will PING itself every 90 seconds if there is no traffic, so disable the purepak on raw handler
  29. #                       that listens for PONG
  30. # Snak adaptation 1.9  Remove signoff handler
  31. #
  32. # To automatically load this into a connection, add "/load purepak.irc" to the startup actions.
  33. #
  34. # ########################################################################## #
  35. #                      PurePak - The sequel to TextBox                       #
  36. #                          A -+ TEXT +- production                           #
  37. # ########################################################################## #
  38. # Author: Crypt Keeper [ckeeper@axiom.access.one.net] (CKeeper on IRC)
  39. # Version 2.07
  40. #
  41. # This script requires at least ircII2.2.9 (Unix) or a fully ircII compatible
  42. # client.  It has only been tested under Unix with ircII2.2.9 and ircII2.8.2.
  43. #
  44. # If you edit this file, you must edit it with a Unix text editor or use
  45. # utilities like dos2unix/unix2dos to convert it to DOS to edit and then
  46. # back to Unix.  If it is edited in a DOS text editor it will be corrupted.
  47. #
  48. # All stolen code is labelled.  If it isn't labelled as stolen code, then it
  49. # is mine.  If you take my code, please give me credit.
  50. #
  51. # PurePak version 2.07 IRC script
  52. # Copyright (C) 1995
  53. #
  54. # This program is free software; you can redistribute it and/or modify
  55. # it under the terms of the GNU General Public License as published by
  56. # the Free Software Foundation; either version 1, or (at your option)
  57. # any later version.
  58. #
  59. # This program is distributed in the hope that it will be useful,
  60. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  61. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  62. # GNU General Public License for more details.
  63. #
  64. # You should have received a copy of the GNU General Public License
  65. # along with this program; if not, write to the Free Software
  66. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  67. # ########################################################################## #
  68.  
  69. ^set novice off
  70. ^set exec_protection off
  71. ^set input_protection off
  72. @ PPVERS = [2.07]
  73.  
  74. # ----------------------------------------------------------------------------
  75. # Sets and key bindings
  76. # ----------------------------------------------------------------------------
  77.  
  78. # See if we're on an EPIC client
  79. EVAL ^if (match(*EPIC* $status_user)) {@ PP.EPIC = 1}
  80.  
  81. EVAL ^set input_prompt [PurePak] version $PPVERS loading...
  82.  
  83. ^set tab on
  84. ^set tab_max 6
  85. ^set send_ignore_msg off
  86. ^set clock_24hour off
  87. ^set clock on
  88. ^set status_away  (away)
  89. ^set user_information [PurePak]
  90. ^set status_user [Lag ??] [PurePak] *
  91. ^set status_query  [Query: %Q]
  92. ^set status_notify  [Activity: %F]
  93. ^set status_oper *
  94. ^set status_overwrite  (overtype)
  95. ^set status_window ^^^^^^^^
  96. ^set status_mode  (+%+)
  97. ^set status_mail  [Mail: %M]
  98. ^set status_server  via %S
  99. ^set channel_name_width 10
  100. ^set debug 0
  101. ^set help_window off
  102. ^set help_prompt on
  103. ^set hold_mode_max 0
  104. ^set input_aliases off
  105. ^set insert_mode on
  106. ^set lastlog 16384
  107. ^set lastlog_level all
  108. ^set scroll on
  109. ^set scroll_lines 1
  110. ^set shell_limit 0
  111. ^set status_hold_lines  (%B)
  112. ^set command_mode off
  113. ^set double_status_line off
  114. ^set suppress_server_motd off
  115. ^set show_end_of_msgs off
  116. ^set beep_when_away 0
  117. EVAL ^set client_information [PurePak] v$PPVERS by Crypt Keeper
  118. ^set status_hold  -- ENTER --
  119. ^set beep_max 2
  120. ^set warn_of_ignores on
  121. ^set verbose_ctcp off
  122. ^set indent on
  123. ^set auto_whowas off
  124. ^set full_status_line on
  125. ^set continued_line  
  126. ^set hide_private_channels off
  127. ^set show_away_once on
  128. ^set history 120
  129. ^set auto_unmark_away off
  130. ^set beep_on_msg NONE
  131. ^set show_channel_names on
  132. ^set show_numerics off
  133. ^set max_recursions 210
  134. ^set log off
  135. ^set logfile irc.log
  136. ^set input_protection off
  137. ^set dcc_block_size 1024
  138. ^set no_ctcp_flood on
  139. ^EVAL ^if ([$mail] == [0]) {^set mail 1}
  140. ^EVAL ^set load_path ~/purepak:./purepak:~:$load_path
  141. ^set hold_mode off
  142. ^set notify_on_termination off
  143. ^set show_who_hopcount off
  144. ^set flood_warning off
  145. ^set flood_rate 1
  146. ^set flood_after 4
  147. ^set flood_users 4
  148. ^EVAL ^set status_format %T %*%@%N%#%Q%S%H%B%A%C%+%I%O%F %W%>%U%M%X%Y%Z 
  149.  
  150. bind ^X meta2
  151. bind ^\ switch_channels
  152. bind ^Q quote_character
  153. bind ^I parse_command ^tk.getmsg 1 $tk.msglist
  154. bind ^R parse_command ^tk.getmsg -1 $tk.msglist
  155. bind ^X^X parse_command tk.delnick
  156. bind ^S toggle_stop_screen
  157. bind ^[ meta1
  158. bind meta1-[ meta2
  159. bind meta1-O meta2
  160. bind meta2-^@ scroll_end
  161. bind meta2-A backward_history
  162. bind meta2-B forward_history
  163. bind meta2-C forward_character
  164. bind meta2-D backward_character
  165. bind meta2-5 parse_command ^s_up
  166. bind meta2-6 parse_command ^s_dn
  167. bind meta2-1 parse_command ^s_end
  168. bind meta2-7 parse_command ^s_end
  169. bind ^X^A scroll_backward
  170. bind ^X^B scroll_forward
  171. bind ^B self_insert
  172. bind ^_ self_insert
  173. bind ^V self_insert
  174. bind ^A self_insert
  175. bind ^O self_insert
  176. bind ^W next_window
  177. bind ^Z stop_irc
  178. bind ^U erase_line
  179.  
  180. alias s_up {
  181.     ^bind ~ nothing
  182.     ^type ^U^X^A^U
  183.     ^timer 1 ^bind ~ self_insert
  184. }
  185. alias s_dn {
  186.     ^bind ~ nothing
  187.     ^type ^U^X^B^U
  188.     ^timer 1 ^bind ~ self_insert
  189. }
  190. alias s_end {
  191.     ^bind ~ nothing
  192.     ^type ^[[^@
  193.     ^timer 1 ^bind ~ self_insert
  194. }
  195.  
  196. # File that settings are saved to
  197. @ PP.SAVEFILE = [purepak.sav]
  198.  
  199. on ^dcc_raw * {}
  200.  
  201. # ----------------------------------------------------------------------------
  202. # Tab key message history (originally from the ircII tabkey script)
  203. # ----------------------------------------------------------------------------
  204.  
  205. alias tk.addmsg {
  206.     @ tk.matched = rmatch($0 $^\1-)
  207.     if (tk.matched)
  208.     {
  209.         @ tk.msglist = [$(0-${tk.matched-1}) $(${tk.matched+1}-)]
  210.     }
  211.     { @ tk.msglist = [$(0-${tk.msgmax-1})] }
  212.     @ tk.msgcnt = 0
  213.     ^assign -tk.matched
  214. }
  215. alias tk.getmsg {
  216.     @ tk.msgcnt = tk.msgcnt + [$0]
  217.     if ( #tk.msglist < tk.msgcnt ) {@ tk.msgcnt = 1}
  218.     if (tk.msgcnt <= 0) {@ tk.msgcnt =  #tk.msglist}
  219.     @ tk.junk = K ## [msg]
  220.     type ^U$tk.junk $^^{[$($tk.msgcnt)]} 
  221. }
  222. alias tk.delnick {
  223.     if (tk.msgcnt == 0)
  224.     {
  225.         echo *** Nickname: $word(0 $tk.msglist) removed.
  226.         @ tk.msglist = [$notword(1 $tk.msglist)]
  227.     }
  228.     {
  229.         echo *** Nickname: $word(${tk.msgcnt-1} $tk.msglist) removed.
  230.         @ tk.msglist = [$notword($tk.msgcnt $tk.msglist)]
  231.     }
  232.     type ^U
  233. }
  234. alias notword {
  235.     if ([$0]>0)
  236.     {
  237.         if (([$0]>1)&&([$0] < rmatch($~ $1-))) {@ nw.sep = [ ]} {@ nw.sep = []}
  238.         @ function_return = [$(1-${[$0]-1})] ## [$nw.sep] ## [$(${[$0]+1}-)]
  239.     } {@ function_return = [$1-]}
  240. }
  241. alias minnot {
  242.     @ noticecnt = 0
  243.     ^assign -lastnoter
  244.     ^assign -ntemp
  245. }
  246.  
  247. # ----------------------------------------------------------------------------
  248. # Miscellaneous functions and aliases, mostly internal
  249. # ----------------------------------------------------------------------------
  250.  
  251. # Lame aliases for buggy clients
  252. # Snak adaptation 1.7. Removed. Snak correctly implements this command
  253. #alias say {
  254. #    quote PRIVMSG $C :$*
  255. #    echo <${N}> $*
  256. #}
  257. alias sendto {
  258.     if (ischannel($0)) {^if ([$0] == C) {/echo <${N}> $1-} {/echo -> $0 <${N}> $1-}} {/echo -> [$0] $1-}
  259.     ^quote PRIVMSG $0 :$1-
  260. }
  261.  
  262. # /me alias that echoes to the right window (some clients don't)
  263. #alias me {
  264. #    xecho -LEVEL CRAP -WINDOW $winnum() * $N $*
  265. #    quote PRIVMSG $C :ACTION $*
  266. #}
  267.  
  268. # Repeats $1 $0 times
  269. alias repeatcmd {
  270.     @ RCOUNT = 0
  271.     while (RCOUNT < [$0])
  272.     {
  273.         @ RCOUNT = RCOUNT + 1
  274.         $1-
  275.     }
  276.     ^assign -RCOUNT
  277. }
  278.  
  279. alias nickonly {@ FUNCTION_RETURN = left($index(! $0) $0)}
  280. alias safestr {@ FUNCTION_RETURN = strip(\;\$ $*)}
  281.  
  282. # Returns 1 if you have ops on $0, 0 if you don't.  We use an alias instead
  283. # of ischanop() since ischanop doesn't always return a correct result on
  284. # older clients, and if ischanop were to say that you are not opped when you
  285. # really are, your protection stuff wouldn't go off.
  286. alias gotops {
  287.     @ FUNCTION_RETURN = 0
  288.     if ([$0] == C) {^if (P == [@]) {@ FUNCTION_RETURN = 1}}
  289.     {^if (ischanop($N $0)) {@ FUNCTION_RETURN = 1}}
  290. }
  291.  
  292. # Returns a random letter/number string
  293. @ PP.RC = [abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789a]
  294. alias randcrap {
  295.     @ RC = 1
  296.     while (RC < [$0])
  297.     {
  298.         @ RC = RC + 1
  299.         @ RS = mid($rand(62) 1 $PP.RC)##RS
  300.     }
  301.     @ RS = mid($rand(25) 1 $PP.RC)##RS
  302.     @ FUNCTION_RETURN = RS
  303.     ^assign -RS
  304.     ^assign -RC
  305. }
  306.  
  307. # Returns true if a string contains letters
  308. alias isalpha {
  309.     if (rmatch($0 *a* *b* *c* *d* *e* *f* *g* *h* *i* *j* *k* *l* *m* *n* *o* *p* *q* *r* *s* *t* *u* *v* *w* *x* *y* *z*)) {@ FUNCTION_RETURN = 1}
  310.     {@ FUNCTION_RETURN = 0}
  311. }
  312.  
  313. # delword <word> <list> (output returned in NLIST)
  314. # recursive alias that deletes a word from a list
  315. alias delword {
  316.     if ([$1] != [$0]) {^assign NLIST $1 $NLIST}
  317.     if ([$2]) {^delword $0 $2-}
  318. }
  319.  
  320. # Check is user is friended/shitted
  321. # ispal/isshit <n!u@h> <#channel>
  322. alias ispal {
  323.     @ FUNCTION_RETURN = 0
  324.     foreach PP.FRIENDS XZ {
  325.         if (match($decode($XZ) $1))
  326.         {
  327.             if (rmatch($0 $PP.FRIENDS[$XZ])) {@ FUNCTION_RETURN = 1}
  328.         }
  329.     }
  330.     ^assign -XZ
  331. }
  332. alias isshit {
  333.     @ FUNCTION_RETURN = 0
  334.     foreach PP.ENEMIES XZ {
  335.         if (match($decode($XZ) $1))
  336.         {
  337.             if (rmatch($0 $PP.ENEMIES[$XZ])) {@ FUNCTION_RETURN = 1}
  338.         }
  339.     }
  340.     ^assign -XZ
  341. }
  342.  
  343. # The pager for long displays, such as in help.
  344. # We do it like this so it doesn't use the old $"-MORE-" method
  345. # which is outdated and causes problems on newer clients.
  346. alias pp.pauseset {
  347.     @ ECCTR = 0
  348.     ^alias echo {
  349.         @ EC[$ECCTR] = [$*]
  350.         @ ECCTR = ECCTR + 1
  351.     }
  352. }
  353. alias pp.pauseend {
  354.     ^alias -echo
  355.     @ ECTR = 0
  356.     ^pp.doechos
  357. }
  358. # Snak adaptation 1.4. Removed check for numlines and "Press ENTER.." input. Snak can scroll...
  359. alias pp.doechos {
  360.     @ LCTR = 0
  361. #    while ((ECTR < ECCTR)&&(LCTR < PP.SET.NUMLINES))
  362.     while (ECTR < ECCTR)
  363.     {
  364.         @ LCTR = LCTR + 1
  365.         echo $EC[$ECTR]
  366.         ^assign -EC[$ECTR]
  367.         @ ECTR = ECTR + 1
  368.     }
  369. #    if ((LCTR >= PP.SET.NUMLINES)&&(ECTR < ECCTR)) {^input "** Press ENTER to continue **" ^pp.doechos}
  370. #    {
  371.         ^assign -LCTR
  372.         ^assign -ECTR
  373.         ^assign -ECCTR
  374.         foreach EC AA {^assign -EC[$AA]}
  375. #    }
  376. }
  377.  
  378. # ----------------------------------------------------------------------------
  379. # Default settings if purepak.sav doesn't exist
  380. # ----------------------------------------------------------------------------
  381.  
  382. # Letters in main settings variable (PP.SET): (this variable is about full)
  383. #   I - Auto-ignore on msg/notice/ctcp floods
  384. #   F - Flood filtering
  385. #   A - Ascii art kicker
  386. #   N - Nick flood protection
  387. #   E - Use enemies list
  388. #   L - Use friends list
  389. #   O - Let everyone know when you are set away
  390. #   G - Log messages and important stuff while away
  391. #   W - Send notices and/or warnings to people
  392. #   J - Auto rejoin on kick
  393. #   M - Mass deop/kick protection
  394. #   K - Channel key flash protection
  395. #   B - Ban protection
  396. #   X - Ignore CTCP PING
  397. #   Y - Ignore CTCP VERSION
  398. #   Z - Ignore CTCP FINGER
  399. #   S - Automatic deop on server ops
  400. #   H - Write awaylog to a file (PP.SET.ALFILE)
  401. #   C - Clonebot mass-join protection
  402. #   Q - Beep on private messages
  403. #   P - Auto-unload help
  404. #   V - Desynched user notification
  405. @ PP.SET = [CGFENLOWJMKBZPV]
  406.  
  407. # Response to mass deop/kick (0 = deop, 1 = kick)
  408. @ PP.SET.MASSRESP = 0
  409. # Auto-ignoring - number of seconds to autoignore
  410. @ PP.SET.IGSECS = 30
  411. # Short kill notice displays
  412. @ PP.SET.SHORTKILLS = 1
  413. # Server notice settings
  414. @ PP.SET.NOTELEVELS = [KUFNMC]
  415. # Nick flood protection sensitivity
  416. @ PP.SET.NFSENS = 3
  417. # Length of the first word in a message for it to be a junkflood
  418. @ PP.SET.JFLEN = 200
  419. # Away log file
  420. @ PP.SET.ALFILE = [away.log]
  421. # Exec commands to do various things
  422. @ PP.SET.FINGERCMD = [finger]
  423. @ PP.SET.LSCMD = [ls -l]
  424. @ PP.SET.LSWCMD = [ls -xp]
  425. @ PP.SET.RMCMD = [rm -f]
  426. @ PP.SET.MAILCMD = [mail]
  427. @ PP.SET.UUECMD = [uuencode]
  428. @ PP.SET.CATCMD = [cat]
  429. @ PP.SET.PSCMD = [ps -uxw]
  430. @ PP.SET.KILLCMD = [kill -KILL]
  431. @ PP.SET.UNGZCMD = [gunzip -c]
  432. @ PP.SET.UNZCMD = [uncompress -c]
  433. @ PP.SET.MKNODCMD = [mknod]
  434. @ PP.SET.NSLOOKCMD = [host]
  435. # Counter variable for awaylog
  436. @ PP.AWAYLCTR = 0
  437. # Minutes of idle-time to be set auto-away (0 disables)
  438. @ PP.SET.AUTOAWAY = 0
  439. # Clonebot mass-join sensitivity (number that must join in a 4 second span
  440. @ PP.SET.CPSENS = 3
  441. # NSLOOKUP on join for IP addresses
  442. @ PP.SET.LOOKJOIN = 1
  443. # Counter for clonebot mass-join detector
  444. @ PP.CPCTR = 0
  445. # Number of lines of output before a pause on help, playback, etc.
  446. @ PP.SET.NUMLINES = 22
  447. # Scripts we should auto-load:
  448. # K = Kicks, X = DCC, B = Bots, S = Silly, W = War
  449. @ PP.SET.AUTOLOAD = [XBS]
  450. # This is set to 1 after the first motd is seen
  451. @ PP.SEENMOTD = 0
  452. # Msg/notice formats
  453. @ PP.SET.MRFORMAT = encode([N!U] M)
  454. @ PP.SET.NRFORMAT = encode(-N- M)
  455. @ PP.SET.MSFORMAT = encode(-> [N] M)
  456. @ PP.SET.NSFORMAT = encode(-> -N- M)
  457. # Channel protection
  458. @ PP.SET.CHANPROT = 1
  459. # Show people as they signoff in splits
  460. @ PP.SET.SHOWSPLITTERS = 0
  461. # Suppress startup messages
  462. @ PP.SET.NOSTARTUP = 0
  463. # Insert random ?'s into bans
  464. @ PP.SET.FUNKYBANS = 1
  465. # Beep on netsplits
  466. @ PP.SET.BSP = 1
  467. # Allow CTCP PAGE
  468. @ PP.SET.CTCPPAGE = 1
  469. # Print time every 10 minutes
  470. @ PP.SET.TP = 0
  471. # Nick to match public
  472. @ PP.SET.PMATCH = [.]
  473.  
  474. # Msg/notice format settings to look like other scripts
  475. @ PP.MR.DEFAULT = encode([N!U] M)
  476. @ PP.MS.DEFAULT = encode(-> [N] M)
  477. @ PP.NR.DEFAULT = encode(-N- M)
  478. @ PP.NS.DEFAULT = encode(-> -N- M)
  479. @ PP.MR.IRCII = encode(*N* M)
  480. @ PP.MS.IRCII = encode(-> *N* M)
  481. @ PP.NR.IRCII = encode(-N- M)
  482. @ PP.NS.IRCII = encode(-> -N- M)
  483. @ PP.MR.TEXTBOX = encode(*N* M)
  484. @ PP.MS.TEXTBOX = encode(-> *N* M)
  485. @ PP.NR.TEXTBOX = encode(-N- M)
  486. @ PP.NS.TEXTBOX = encode(-> -N- M)
  487. @ PP.MR.LICE = encode([N!U] M)
  488. @ PP.MS.LICE = encode([*N*] M)
  489. @ PP.NR.LICE = encode(-N!U- M)
  490. @ PP.NS.LICE = encode([-N-] M)
  491. @ PP.MR.PHOENIX = encode([N:U] M)
  492. @ PP.MS.PHOENIX = encode(<-[N]-> M)
  493. @ PP.NR.PHOENIX = encode(-N- M)
  494. @ PP.NS.PHOENIX = encode(-> -N- M)
  495.  
  496. # ----------------------------------------------------------------------------
  497. # /pp alias to set script options
  498. # ----------------------------------------------------------------------------
  499.  
  500. # Other script parts (the pp-*.irc scripts) can add to this array and have
  501. # their settings under /pp
  502. @ PP.SETCHECKS.M = [^pp.set.m]
  503.  
  504. alias pp.set.bstatus {^if ([$0]) {@ FUNCTION_RETURN = [ON ]} {@ FUNCTION_RETURN = [OFF]}}
  505. alias pp.set.tstatus {^if (index($0 $PP.SET) >= 0) {@ FUNCTION_RETURN = [ON ]} {@ FUNCTION_RETURN = [OFF]}}
  506. alias pp.set.changetoggle {
  507.     if ([$1])
  508.     {
  509.         if ([$1] == [OFF]) {@ PP.SET = strip($0 $PP.SET)}
  510.         {^if (index($0 $PP.SET) < 0) {@ PP.SET = [$0]##PP.SET}}
  511.     }
  512. }
  513. # Snak adaptation 1.4. Snak already handles this
  514. alias pp.set.setupctcp {
  515. #    if (index(X $PP.SET) < 0) {^on raw_irc - "% PRIVMSG % :**PING**"} {^on ^raw_irc "% PRIVMSG % :**PING**" {}}
  516. #    if (index(Y $PP.SET) < 0) {^on raw_irc - "% PRIVMSG % :**VER**"} {^on ^raw_irc "% PRIVMSG % :**VER**" {}}
  517. #    if (index(Z $PP.SET) < 0) {^on raw_irc - "% PRIVMSG % :**FINGER**"} {^on ^raw_irc "% PRIVMSG % :**FINGER**" {}}
  518. }
  519. alias pp.set.onoff {^if ([$0]) {@ FUNCTION_RETURN = [ON]} {@ FUNCTION_RETURN = [OFF]}}
  520.  
  521. alias status {
  522.     ^pp.pauseset
  523.     echo -- Current PurePak settings:
  524.     echo -- ===========================================================================
  525.     echo -- Automatic flood ignoring (AIGnore)                      : $pp.set.tstatus(I)
  526.     echo -- Filtering of known floods (FFILTer)                     : $pp.set.tstatus(F)
  527.     echo -- ASCII art kicker (ARTKick)                              : $pp.set.tstatus(A)
  528.     echo -- Kicking on kick flood (NFProt)                          : $pp.set.tstatus(N)
  529.     echo -- Use of enemies list (ENEMies)                           : $pp.set.tstatus(E)
  530.     echo -- Use of friends list (FRIends)                           : $pp.set.tstatus(L)
  531.     echo -- Public announcement of away status (AWAYNotices)        : $pp.set.tstatus(O)
  532.     echo -- Logging of msgs/events while away (AWAYLogging)         : $pp.set.tstatus(G)
  533.     echo -- Logging to an away log file (AWAYWriting)               : $pp.set.tstatus(H)
  534.     echo -- Name of away log file (AFILE)                           : ${PP.SET.ALFILE}
  535.     echo -- General miscellaneous warnings/notices (NOTIces)        : $pp.set.tstatus(W)
  536.     echo -- Automatic rejoining on kick (KREJoin)                   : $pp.set.tstatus(J)
  537.     echo -- Mass deop/kick protection (MASSProt)                    : $pp.set.tstatus(M)
  538.     if (PP.SET.MASSRESP) {
  539.     echo -- Action taken on mass deop/kick (MASSAction)             : KICK
  540.     } {
  541.     echo -- Action taken on mass deop/kick (MASSAction)             : DEOP
  542.     }
  543.     echo -- Channel protection (CHANprot)                           : $pp.set.onoff($PP.SET.CHANPROT)
  544.     echo -- Automatic removal of server ops (SERVOP)                : $pp.set.tstatus(S)
  545.     echo -- Channel key flash protection (KEYProt)                  : $pp.set.tstatus(K)
  546.     echo -- Ban defense (BANDefense)                                : $pp.set.tstatus(B)
  547.     echo -- Ignoring of CTCP PINGs (PING)                           : $pp.set.tstatus(X)
  548.     echo -- Ignoring of CTCP FINGERs (FINGer)                       : $pp.set.tstatus(Z)
  549.     echo -- Ignoring of CTCP VERSIONs (VERsion)                     : $pp.set.tstatus(Y)
  550.     echo -- Seconds to auto-ignore flooders (IGTime)                : ${PP.SET.IGSECS}
  551.     echo -- Nick flood protection sensitivity (NFSens)              : ${PP.SET.NFSENS}
  552.     echo -- Length of first word for a msg to be junkflood (JFLEN)  : ${PP.SET.JFLEN}
  553.     echo -- Desynched user notification (DESynchnote)               : $pp.set.tstatus(V)
  554.     echo -- Beeping on private messages (MSGBeep)                   : $pp.set.tstatus(Q)
  555.     if (PP.SET.AUTOAWAY) {
  556.     echo -- Minutes of idle time before being set away (AUTOAway)   : ${PP.SET.AUTOAWAY}
  557.     } {
  558.     echo -- Minutes of idle time before being set away (AUTOAway)   : OFF
  559.     }
  560.     echo -- NS lookup of IP adresses on join                        : $pp.set.onoff($PP.SET.LOOKJOIN)
  561.     echo -- Clonebot mass-join protection (CLONEProt)               : $pp.set.tstatus(C)
  562.     echo -- Clonebot mass-join protection sensitivity (CLONESens)   : ${PP.SET.CPSENS}
  563.     if (suppress_server_motd == [ON])
  564.     {
  565.     echo -- Server motd display at startup (MOTD)                   : OFF
  566.     } {
  567.     echo -- Server motd display at startup (MOTD)                   : ON
  568.     }
  569.     echo -- Show users who join/signoff in splits (SHOWSPLITters)   : $pp.set.onoff($PP.SET.SHOWSPLITTERS)
  570.     echo -- Number of rows on this display (ROWS)                   : ${PP.SET.NUMLINES + 2}
  571.     echo -- Auto-loading of pp-bots.irc (LOADBots)                  : $pp.set.sload(B)
  572.     echo -- Auto-loading of pp-xdcc.irc (LOADXdcc)                  : $pp.set.sload(X)
  573.     echo -- Auto-loading of pp-silly.irc (LOADSilly)                : $pp.set.sload(S)
  574.     echo -- Auto-loading of pp-war.irc (LOADWar)                    : $pp.set.sload(W)
  575.     echo -- Auto-loading of pp-kicks.irc (LOADKicks)                : $pp.set.sload(K)
  576.     echo -- Suppression of script startup screens                   : $pp.set.onoff($PP.SET.NOSTARTUP)
  577.     echo -- Insert random ?'s into bans (FUNkybans)                 : $pp.set.onoff($PP.SET.FUNKYBANS)
  578.     echo -- Beep on netsplits (BEEPSPLIT)                           : $pp.set.onoff($PP.SET.BSP)
  579.     echo -- CTCP PAGE (PAGE)                                        : $pp.set.onoff($PP.SET.CTCPPAGE)
  580.     echo -- Print time every 10 minutes (TPRINT)                    : $pp.set.onoff($PP.SET.TP)
  581.     echo -- String to match and highlight in public (PMATCH)        : ${PP.SET.PMATCH}
  582.     echo -- ===========================================================================
  583.     ^pp.pauseend
  584. }
  585.  
  586. alias pp.set.sload {
  587.     if ([$1])
  588.     {
  589.         if ([$1] == [ON])
  590.         {
  591.             if (index($0 $PP.SET.AUTOLOAD) < 0) {@ PP.SET.AUTOLOAD = PP.SET.AUTOLOAD##[$0]}
  592.             pp.autoload
  593.         } {@ PP.SET.AUTOLOAD = strip($0 $PP.SET.AUTOLOAD)}
  594.     } {^if (index($0 $PP.SET.AUTOLOAD) >= 0) {@ FUNCTION_RETURN = [ON]} {@ FUNCTION_RETURN = [OFF]}}
  595. }
  596. alias pp.autoload {
  597.     if ((index(K $PP.SET.AUTOLOAD) >= 0)&&(!(PP.KICKS))) {/load pp-kicks.irc}
  598.     if ((index(B $PP.SET.AUTOLOAD) >= 0)&&(!(PP.BOTS))) {/load pp-bots.irc}
  599.     if ((index(S $PP.SET.AUTOLOAD) >= 0)&&(!(PP.SILLY))) {/load pp-silly.irc}
  600.     if ((index(X $PP.SET.AUTOLOAD) >= 0)&&(!(PP.DCC))) {/load pp-dcc.irc}
  601.     if ((index(W $PP.SET.AUTOLOAD) >= 0)&&(!(PP.WAR))) {/load pp-war.irc}
  602. }
  603.  
  604. alias pp.set.setmformat {
  605.     echo *** Special characters in msg/notice outgoing display formats:
  606.     echo ***   N = Nickname of person you are sending to
  607.     echo ***   M = Text of the message you are sending
  608.     echo ***   T = Current time
  609.     echo *** Special characters in msg/notice incoming display formats:
  610.     echo ***   N = Nickname of the person who sent the msg/notice
  611.     echo ***   U = User@host of sender
  612.     echo ***   M = Text of message
  613.     echo ***   T = Current time
  614.     echo *** ^V,^B,^O,^_ control characters can also be used
  615.     echo ***
  616.     echo *** You may enter new formats for any of these, or press enter for no
  617.     echo *** change.
  618.     echo ***
  619.     echo *** Current incoming message format is: $decode($PP.SET.MRFORMAT)
  620.     ^input "New incoming message format or enter for no change >>" if (1) {
  621.         if ([$0]) {@ PP.SET.MRFORMAT = encode($*)}
  622.         echo *** Current outgoing message format is: $decode($PP.SET.MSFORMAT)
  623.         ^input "New outgoing message format or enter for no change >>" if (1) {
  624.             if ([$0]) {@ PP.SET.MSFORMAT = encode($*)}
  625.             echo *** Current incoming notice format is: $decode($PP.SET.NRFORMAT)
  626.             ^input "New incoming notice format or enter for no chaange >>" if (1) {
  627.                 if ([$0]) {@ PP.SET.NRFORMAT = encode($*)}
  628.                 echo *** Current outgoing notice format is: $decode($PP.SET.NSFORMAT)
  629.                 ^input "New outgoing notice format or enter for no change >>" if (1) {
  630.                     if ([$0]) {@ PP.SET.NSFORMAT = encode($*)}
  631.                     echo ***
  632.                     echo *** Message formats are now set to:
  633.                     echo *** Incoming message: $decode($PP.SET.MRFORMAT)
  634.                     echo *** Outgoing message: $decode($PP.SET.MSFORMAT)
  635.                     echo *** Incoming notice: $decode($PP.SET.NRFORMAT)
  636.                     echo *** Outgoing notice: $decode($PP.SET.NSFORMAT)
  637.                     echo ***
  638.                     echo *** If you have made changes, you must save with /sve for your changes
  639.                     echo *** to become permanent.
  640.                 }
  641.             }
  642.         }
  643.     }
  644. }
  645.  
  646. # *** Main script settings:
  647. # AIGnore = Automatic flood ignoring
  648. # FFILTer = Filtering of known floods
  649. # ARTKick = ASCII art kicker
  650. # NFProt = Kicking on nick flood
  651. # ENEMies = Use of enemies list
  652. # FRIends = Use of friends list
  653. # AWAYNotices = Public announcement of away status
  654. # AWAYLogging = Logging of msgs/events while away
  655. # AWAYWriting = Logging to an away log file
  656. # AFILE = Name of away log file
  657. # NOTIces = General warnings/notices
  658. # KREJoin = Automatic rejoining on kick
  659. # MASSProt = Mass deop/kick protection
  660. # MASSAction = Action taken on mass deop/kick
  661. # SERVOP = Automatic removal of server ops
  662. # KEYProt = Channel key flash protection
  663. # BANDefense = Ban defense
  664. # PING = Ignoring of CTCP PING
  665. # FINGer = Ignoring of CTCP FINGER
  666. # VERsion = Ignoring of CTCP VERSION
  667. # IGTime = Seconds to auto-ignore flooders
  668. # NFSens = Sensitivity of nick flood protection (higher values more sensitive)
  669. # JFLEN = First word length for a message to be a junkflood
  670. # *CMD = Correspond with PP.SET.*CMD above
  671. # MSGBeep = Beep on private messages
  672. # AUTOAway = Minutes of idle-time to be automaticly set away
  673. # CLONEProt = Clonebot mass-join protection
  674. # CLONESens = Sensitivity of clonebot mass-join protection (lower values more sensitive)
  675. # ROWS = Number of rows on display
  676. # LOADBots = Auto load pp-bots.irc
  677. # LOADWar = Auto load pp-war.irc
  678. # LOADSilly = Auto load pp-silly.irc
  679. # LOADKicks = Auto load pp-kicks.irc
  680. # LOADDcc = Auto load pp-dcc.irc
  681. # HELPUnload = Auto unloading of help
  682. # DESynchnote = Desynched user notification
  683. # WRITEMETHOD = /sve write method
  684. # MOTD = Server motd display at startup
  685. # MFORMAT = Msg/notice format settings
  686. # CHANprot = Channel protection
  687. # SHOWSPLITters = Show users who join/signoff in splits
  688. # LOOKJoin = NS lookup of IP adresses on join
  689. # NOSTARTUP = Suppression of startup screens
  690. # FUNkybans = Insert random ?'s into bans
  691. # BEEPSPLIT = Beep on netsplits
  692. # PAGE = CTCP PAGE
  693. # TPRINT = Print time every 10 minutes
  694. # PMATCH = String to match and highlight publicly
  695. alias pp.set.m {
  696.     if (rmatch($0 LOADK* LOADB* LOADW* LOADS* LOADD*))
  697.     {
  698.         if (match($1 ON OFF))
  699.         {
  700.             if (match(LOADB* $0)) {/pp.set.sload B $1}
  701.             if (match(LOADW* $0)) {/pp.set.sload W $1}
  702.             if (match(LOADS* $0)) {/pp.set.sload S $1}
  703.             if (match(LOADK* $0)) {/pp.set.sload K $1}
  704.             if (match(LOADD* $0)) {/pp.set.sload X $1}
  705.         }
  706.         if (match(LOADB* $0)) {/echo *** Auto-loading of pp-bots.irc is now $pp.set.sload(B)}
  707.         if (match(LOADW* $0)) {/echo *** Auto-loading of pp-war.irc is now $pp.set.sload(W)}
  708.         if (match(LOADS* $0)) {/echo *** Auto-loading of pp-silly.irc is now $pp.set.sload(S)}
  709.         if (match(LOADK* $0)) {/echo *** Auto-loading of pp-kicks.irc is now $pp.set.sload(K)}
  710.         if (match(LOADD* $0)) {/echo *** Auto-loading of pp-dcc.irc is now $pp.set.sload(X)}
  711.         @ VU = 1
  712.     }
  713.     if ([$0] == [PAGE])
  714.     {
  715.         if (match($1 ON OFF))
  716.         {
  717.             if ([$1] == [ON]) {@ PP.SET.CTCPPAGE = 1} {@ PP.SET.CTCPPAGE = 0}
  718.         }
  719.         echo *** CTCP PAGE response is now $pp.set.onoff($PP.SET.CTCPPAGE)
  720.         @ VU = 1
  721.     }
  722.     if ([$0] == [TPRINT])
  723.     {
  724.         if (match($1 ON OFF))
  725.         {
  726.             if ([$1] == [ON]) {@ PP.SET.TP = 1} {@ PP.SET.TP = 0}
  727.         }
  728.         echo *** Print time every 10 minutes is now $pp.set.onoff($PP.SET.TP)
  729.         @ VU = 1
  730.     }
  731.     if ([$0] == [BEEPSPLIT])
  732.     {
  733.         if (match($1 ON OFF))
  734.         {
  735.             if ([$1] == [ON]) {@ PP.SET.BSP = 1} {@ PP.SET.BSP = 0}
  736.         }
  737.         echo *** Beep on netsplits is now $pp.set.onoff($PP.SET.BSP)
  738.         @ VU = 1
  739.     }
  740.     if (match(LOOKJ* $0))
  741.     {
  742.         if (match($1 ON OFF))
  743.         {
  744.             if ([$1] == [ON]) {@ PP.SET.LOOKJOIN = 1} {@ PP.SET.LOOKJOIN = 0}
  745.         }
  746.         echo *** NS lookup of IP adresses on join is now $pp.set.onoff($PP.SET.LOOKJOIN)
  747.         @ VU = 1
  748.     }
  749.     if ([$0] == [NOSTARTUP])
  750.     {
  751.         if (match($1 ON OFF))
  752.         {
  753.             if ([$1] == [ON]) {@ PP.SET.NOSTARTUP = 1} {@ PP.SET.NOSTARTUP = 0}
  754.         }
  755.         echo *** Suppression of script startup screens is now $pp.set.onoff($PP.SET.NOSTARTUP)
  756.         @ VU = 1
  757.     }
  758.     if (match(FUN* $0))
  759.     {
  760.         if (match($1 ON OFF))
  761.         {
  762.             if ([$1] == [ON]) {@ PP.SET.FUNKYBANS = 1} {@ PP.SET.FUNKYBANS = 0}
  763.         }
  764.         echo *** Insert random ?'s into bans is now $pp.set.onoff($PP.SET.FUNKYBANS)
  765.         @ VU = 1
  766.     }
  767.     if (match(SHOWSPLIT* $0))
  768.     {
  769.         if (match($1 ON OFF))
  770.         {
  771.             if ([$1] == [ON]) {@ PP.SET.SHOWSPLITTERS = 1} {@ PP.SET.SHOWSPLITTERS = 0}
  772.         }
  773.         echo *** Showing of users who join/signoff in netsplits is now $pp.set.onoff($PP.SET.SHOWSPLITTERS)
  774.         @ VU = 1
  775.     }
  776.     if ([$0] == [MFORMAT])
  777.     {
  778.         @ VU = 1
  779.         if ([$1])
  780.         {
  781.             if (match($1 IRCII TEXTBOX PHOENIX LICE DEFAULT))
  782.             {
  783.                 @ PP.SET.MRFORMAT = PP.MR[$1]
  784.                 @ PP.SET.NRFORMAT = PP.NR[$1]
  785.                 @ PP.SET.MSFORMAT = PP.MS[$1]
  786.                 @ PP.SET.NSFORMAT = PP.NS[$1]
  787.                 echo *** Your msgs/notices now look like: $toupper($1)
  788.             } {/echo *** /pp mformat [<ircii/textbox/phoenix/lice>]}
  789.         } {^pp.set.setmformat}
  790.     }
  791.     if (match(CHAN* $0))
  792.     {
  793.         if (match($1 ON OFF))
  794.         {
  795.             if ([$1] == [ON]) {@ PP.SET.CHANPROT = 1} {@ PP.SET.CHANPROT = 0}
  796.         }
  797.         echo *** Channel protection is now $pp.set.onoff($PP.SET.CHANPROT)
  798.         @ VU = 1
  799.     }
  800.     if (match(DES* $0))
  801.     {
  802.         ^pp.set.changetoggle V $1
  803.         echo *** Desynched user notification is now $pp.set.tstatus(V)
  804.         @ VU = 1
  805.     }
  806.     if (match(AIG* $0))
  807.     {
  808.         ^pp.set.changetoggle I $1
  809.         echo *** Auto-ignoring on msg/notice/ctcp/nick floods is now $pp.set.tstatus(I)
  810.         @ VU = 1
  811.     }
  812.     if ([$0] == [MOTD])
  813.     {
  814.         if (match($1 ON OFF))
  815.         {
  816.             if ([$1] == [ON]) {^set suppress_server_motd OFF} {^set suppress_server_motd ON}
  817.         }
  818.         if (suppress_server_motd == [ON]) {/echo *** Server motd display at startup is now OFF}
  819.         {/echo *** Server motd display at startup is now ON}
  820.         @ VU = 1
  821.     }
  822.     if (match(FFILT* $0))
  823.     {
  824.         ^pp.set.changetoggle F $1
  825.         echo *** Filtering of known floods in msgs/notices/public messages is now $pp.set.tstatus(F)
  826.         @ VU = 1
  827.     }
  828.     if (match(ARTK* $0))
  829.     {
  830.         ^pp.set.changetoggle A $1
  831.         echo *** ASCII art kicker is now $pp.set.tstatus(A)
  832.         @ VU = 1
  833.     }
  834.     if (match(HELPU* $0))
  835.     {
  836.         ^pp.set.changetoggle P $1
  837.         echo *** Automatic unloading of help information is now $pp.set.tstatus(P)
  838.         @ VU = 1
  839.     }
  840.     if (match(NFP* $0))
  841.     {
  842.         ^pp.set.changetoggle N $1
  843.         echo *** Kicking on nick flood is now $pp.set.tstatus(N)
  844.         @ VU = 1
  845.     }
  846.     if (match(ENEM* $0))
  847.     {
  848.         ^pp.set.changetoggle E $1
  849.         echo *** Checking/use of enemies list is now $pp.set.tstatus(E)
  850.         @ VU = 1
  851.     }
  852.     if (match(FRI* $0))
  853.     {
  854.         ^pp.set.changetoggle L $1
  855.         echo *** Checking/use of friends list is now $pp.set.tstatus(L)
  856.         @ VU = 1
  857.     }
  858.     if (match(AWAYN* $0))
  859.     {
  860.         ^pp.set.changetoggle O $1
  861.         echo *** Public announcement of away status is now $pp.set.tstatus(O)
  862.         @ VU = 1
  863.     }
  864.     if (match(AWAYL* $0))
  865.     {
  866.         ^pp.set.changetoggle G $1
  867.         echo *** Logging of messages and important events while away is now $pp.set.tstatus(G)
  868.         @ VU = 1
  869.     }
  870.     if (match(NOTI* $0))
  871.     {
  872.         ^pp.set.changetoggle W $1
  873.         echo *** Sending of general warnings/notices is now $pp.set.tstatus(W)
  874.         @ VU = 1
  875.     }
  876.     if (match(KREJ* $0))
  877.     {
  878.         ^pp.set.changetoggle J $1
  879.         echo *** Automatic rejoining on kick is now $pp.set.tstatus(J)
  880.         @ VU = 1
  881.     }
  882.     if (match(MASSP* $0))
  883.     {
  884.         ^pp.set.changetoggle M $1
  885.         echo *** Mass deop/kick protection is now $pp.set.tstatus(M)
  886.         @ VU = 1
  887.     }
  888.     if (match(MASSA* $0))
  889.     {
  890.         if (match($1 KICK DEOP))
  891.         {
  892.             if ([$1] == [KICK]) {@ PP.SET.MASSRESP = 1} {@ PP.SET.MASSRESP = 0}
  893.         }
  894.         if (PP.SET.MASSRESP) {/echo *** Action taken on mass deop/kick is now KICK}
  895.         {/echo *** Action taken on mass deop/kick is now DEOP}
  896.         @ VU = 1
  897.     }
  898.     if (match(KEYP* $0))
  899.     {
  900.         ^pp.set.changetoggle K $1
  901.         echo *** Channel key flash protection is now $pp.set.tstatus(K)
  902.         @ VU = 1
  903.     }
  904.     if (([$0] == [SERVOP])||([$0] == [NHP]))
  905.     {
  906.         ^pp.set.changetoggle S $1
  907.         echo *** Automatic removal of server ops is now $pp.set.tstatus(S)
  908.         @ VU = 1
  909.     }
  910.     if (match(CLONEP* $0))
  911.     {
  912.         ^pp.set.changetoggle C $1
  913.         echo *** Clonebot mass-join protection is now $pp.set.tstatus(C)
  914.         @ VU = 1
  915.     }
  916.     if (match(BAND* $0))
  917.     {
  918.         ^pp.set.changetoggle B $1
  919.         echo *** Ban defense is now $pp.set.tstatus(B)
  920.         @ VU = 1
  921.     }
  922.     if ([$0] == [PING])
  923.     {
  924.         ^pp.set.changetoggle X $1
  925.         echo *** Ignoring of CTCP PINGs is now $pp.set.tstatus(X)
  926.         @ VU = 1
  927.         ^pp.set.setupctcp
  928.     }
  929.     if (match(FING* $0))
  930.     {
  931.         ^pp.set.changetoggle Z $1
  932.         echo *** Ignoring of CTCP FINGERs is now $pp.set.tstatus(Z)
  933.         @ VU = 1
  934.         ^pp.set.setupctcp
  935.     }
  936.     if (match(VER* $0))
  937.     {
  938.         ^pp.set.changetoggle Y $1
  939.         echo *** Ignoring of CTCP VERSIONs is now $pp.set.tstatus(Y)
  940.         @ VU = 1
  941.         ^pp.set.setupctcp
  942.     }
  943. # Snak adaptation 1.3 Snak has integrated highlighting
  944. #    if ([$0] == [PMATCH])
  945. #    {
  946. #        if ([$1])
  947. #        {
  948. #            if ((PP.SET.PMATCH == [.])&&([$1] != [.])) {^pp.snm $strip(_-[] $N) $1}
  949. #            if ((PP.SET.PMATCH != [.])&&([$1] == [.])) {^pp.snm $PP.SET.PMATCH $strip(_-[] $N)}
  950. #            @ PP.SET.PMATCH = [$1]
  951. #        }
  952. #        echo *** String to match and highlight in public now set to ${PP.SET.PMATCH}
  953. #        @ VU = 1
  954. #    }
  955.     if (match(IGT* $0))
  956.     {
  957.         if ([$1]) {
  958.             if (!isalpha($1)) {@ PP.SET.IGSECS = [$1]}
  959.             {/echo *** Must be a number (recommended value: 10-60)}
  960.         }
  961.         echo *** Number of seconds to auto-ignore flooders is now: ${PP.SET.IGSECS}
  962.         @ VU = 1
  963.     }
  964.     if (match(NFS* $0))
  965.     {
  966.         if ([$1]) {
  967.             if (!isalpha($1)) {@ PP.SET.NFSENS = [$1]}
  968.             {/echo *** Must be a number (recommended value: 3)}
  969.         }
  970.         echo *** Nick flood protection sensitivity is now: ${PP.SET.NFSENS}
  971.         if (PP.SET.NFSENS > 3) {/echo *** Warning: a setting of ${PP.SET.NFSENS} is very sensitive! (higher values more sensitive)}
  972.         @ VU = 1
  973.     }
  974.     if ([$0] == [ROWS])
  975.     {
  976.         if ([$1]) {
  977.             if (!isalpha($1)) {@ PP.SET.NUMLINES = [$1] - 2}
  978.             {/echo *** Must be a number}
  979.         }
  980.         echo *** Number of rows on this display is now: ${PP.SET.NUMLINES + 2}
  981.         @ VU = 1
  982.     }
  983.     if (match(CLONES* $0))
  984.     {
  985.         if ([$1]) {
  986.             if (!isalpha($1)) {@ PP.SET.CPSENS = [$1]}
  987.             {/echo *** Must be a number (recommended value: 3-5)}
  988.         }
  989.         echo *** Clonebot mass-join protection sensitivity is now: ${PP.SET.CPSENS}
  990.         if (PP.SET.CPSENS < 3) {/echo *** Warning: a setting of ${PP.SET.CPSENS} is very sensitive! (lower values more sensitive)}
  991.         @ VU = 1
  992.     }
  993.     if ([$0] == [JFLEN])
  994.     {
  995.         if ([$1]) {
  996.             if (!isalpha($1)) {@ PP.SET.JFLEN = [$1]}
  997.             {/echo *** Must be a number (recommended value: 200)}
  998.         }
  999.         echo *** First word length for a message to be a junkflood is now: ${PP.SET.JFLEN}
  1000.         @ VU = 1
  1001.     }
  1002.     if (match(AUTOA* $0))
  1003.     {
  1004.         if ([$1]) {
  1005.             if (!isalpha($1)) {@ PP.SET.AUTOAWAY = [$1]}
  1006.             {
  1007.                 if ([$1] == [OFF]) {@ PP.SET.AUTOAWAY = 0} {/echo *** Must be a number or 'off' to turn off.}
  1008.             }
  1009.         }
  1010.         echo *** Minutes of idle-time before being set away (0=auto-away disabled): ${PP.SET.AUTOAWAY}
  1011.         @ VU = 1
  1012.     }
  1013.     if (match(*CMD $0))
  1014.     {
  1015.         foreach PP.SET AA {
  1016.             if ([$AA] == [$0])
  1017.             {
  1018.                 if ([$1]) {@ PP.SET[$AA] = [$1-]}
  1019.                 echo *** $AA is now [${PP.SET[$AA]}]
  1020.                 @ VU = 1
  1021.             }
  1022.         }
  1023.     }
  1024.     if (match(MSGB* $0))
  1025.     {
  1026.         if (match($1 ON OFF))
  1027.         {
  1028.             ^pp.set.changetoggle Q $1
  1029.             if ([$1] == [ON]) {^set beep_on_msg MSG}
  1030.             {^set beep_on_msg NONE}
  1031.         }
  1032.         echo *** Beeping on private messages is now $pp.set.tstatus(Q)
  1033.         @ VU = 1
  1034.     }
  1035.     if (match(LOGF* $0))
  1036.     {
  1037.         if ([$1]) {^set logfile $1}
  1038.         echo *** IRC logging is now sent to file ${LOGFILE}
  1039.         @ VU = 1
  1040.     }
  1041.     if ([$0] == [LOG])
  1042.     {
  1043.         if (match($1 ON OFF)) {^if ([$1] == [ON]) {^set log on} {^set log off}}
  1044.         echo *** Logging to $LOGFILE is now ${LOG}
  1045.         @ VU = 1
  1046.     }
  1047.     if (match(AWAYW* $0))
  1048.     {
  1049.         ^pp.set.changetoggle H $1
  1050.         echo *** Away log writing to $PP.SET.ALFILE is now $pp.set.tstatus(H)
  1051.         @ VU = 1
  1052.     }
  1053.     if ([$0] == [AFILE])
  1054.     {
  1055.         if ([$1]) {@ PP.SET.ALFILE = [$1]}
  1056.         echo *** Away log file is now ${PP.SET.ALFILE}
  1057.         @ VU = 1
  1058.     }
  1059. }
  1060.  
  1061. alias pp {
  1062.     if ([$0])
  1063.     {
  1064.         @ VU = 0
  1065.         foreach PP.SETCHECKS AA {^if (!VU) {$PP.SETCHECKS[$AA] $*}}
  1066.         if (!VU) {/echo *** No such variable: $0}
  1067.         ^assign -VU
  1068.     } {/echo *** /pp <variable> [<new setting>] (If new setting is left out, current setting is shown)}
  1069. }
  1070.  
  1071. # ----------------------------------------------------------------------------
  1072. # Command abbreviations
  1073. # ----------------------------------------------------------------------------
  1074.  
  1075. alias w {/who $*}
  1076. alias m {/msg $*}
  1077. alias t {/topic $*}
  1078. alias c {/mode $*}
  1079. alias l {
  1080.     leave $0
  1081.     if ([$1]) {/l $1-}
  1082. }
  1083. alias j {
  1084.     if (ischannel($1)) {/join $0} {/join $0 $1}
  1085.     if (ischannel($1)) {/j $1-}
  1086.     if (ischannel($2)) {/j $2-}
  1087. }
  1088. alias , {/whois $*}
  1089. alias wi {/whois $*}
  1090. alias ww {/whowas $*}
  1091. alias n {/nick $*}
  1092. alias k {/kick $*}
  1093. alias o {/op $*}
  1094. alias d {/deop $*}
  1095.  
  1096. alias scan {/names $*}
  1097.  
  1098. # ----------------------------------------------------------------------------
  1099. # Basic channel op command aliases
  1100. # ----------------------------------------------------------------------------
  1101.  
  1102. # Here's all the recursive list processing aliases for the mass commands
  1103. # pp.listm.<# at once> <mode> <#channel> <users>
  1104. alias pp.listm.1 {
  1105.     //mode $1 $0 $2
  1106.     if ([$3]) {^pp.listm.1 $0 $1 $3-}
  1107. }
  1108. alias pp.listm.2 {
  1109.     //mode $1 $0 $2 $3
  1110.     if ([$4]) {^pp.listm.2 $0 $1 $4-}
  1111. }
  1112. alias pp.listm.3 {
  1113.     //mode $1 $0 $2 $3 $4
  1114.     if ([$5]) {^pp.listm.3 $0 $1 $5-}
  1115. }
  1116. alias pp.listm.4 {
  1117.     //mode $1 $0 $2 $3 $4 $5
  1118.     if ([$6]) {^pp.listm.4 $0 $1 $6-}
  1119. }
  1120. # pp.listk <#channel> <nicks> ($KREASON contains reason for kicks)
  1121. alias pp.listk {
  1122.     //kick $0 $1 $KREASON
  1123.     if ([$2]) {^pp.listk $0 $2-}
  1124. }
  1125. # pp.listdcc <file> <nicks>
  1126. alias pp.listdcc {
  1127.     //^dcc send $1 $0
  1128.     if ([$2]) {^pp.listdcc $0 $2-}
  1129. }
  1130. # pp.listmsg <PRIVMSG/NOTICE> <nicks/channels> (SEND_MSG contains message)
  1131. alias pp.listmsg {
  1132.     ^quote $0 $1 :$SEND_MSG
  1133.     if ([$2]) {^pp.listmsg $0 $2-}
  1134. }
  1135. # pp.listunban <#channel> <strings>
  1136. alias pp.listunban {
  1137.     if ([$4])
  1138.     {
  1139.         //mode $0 -bbb $1 $2 $3
  1140.         ^pp.listunban $0 $4-
  1141.     } {^if ([$3]) {//mode $0 -bbb $1 $2 $3} {^if ([$2]) {//mode $0 -bb $1 $2} {^if ([$1]) {//mode $0 -b $1}}}}
  1142. }
  1143.  
  1144. # pp.mdop <#channel> <# at once> <mask>
  1145. # Smart massdeopper: deops the closest people net-wise first.  (Gee, I wonder
  1146. # how many scripts this is gonna appear in?)
  1147. alias pp.mdop {
  1148.     @ HIGHHOPS = 0
  1149.     @ DMASK = [$2]
  1150.     on ^who * {
  1151.         if ((match(*${DMASK}* $1!$3@$4))&&([$1] != N))
  1152.         {
  1153.             if (!match($1 $PP.BOTNICKS))
  1154.             {
  1155.                 if (!PP.EPIC)
  1156.                 {
  1157.                     @ MDOPZ[$5] = MDOPZ[$5]##[ $1]
  1158.                     if ([$5] > HIGHHOPS) {@ HIGHHOPS = [$5]}
  1159.                 }
  1160.                 {
  1161.                     @ MDOPZ[$6] = MDOPZ[$6]##[ $1]
  1162.                     if ([$6] > HIGHHOPS) {@ HIGHHOPS = [$6]}
  1163.                 }
  1164.             }
  1165.         }
  1166.     }
  1167.     //^who -chops $0
  1168.     @ DEOPCNT = [$1]
  1169.     @ DEOPCHAN = [$0]
  1170.     wait -CMD if (1) {
  1171.         if (DEOPCNT <= 1) {@ MCH = [-o]}
  1172.         if (DEOPCNT == 2) {@ MCH = [-oo]}
  1173.         if (DEOPCNT == 3) {@ MCH = [-ooo]}
  1174.         if (DEOPCNT >= 4) {@ MCH = [-oooo]}
  1175.         @ CTR = 0
  1176.         while (CTR <= HIGHHOPS)
  1177.         {
  1178.             @ MDOPZ = MDOPZ##[ $MDOPZ[$CTR]]
  1179.             ^assign -MDOPZ[$CTR]
  1180.             @ CTR = CTR + 1
  1181.         }
  1182.         ^pp.listm.$DEOPCNT $MCH $DEOPCHAN $MDOPZ
  1183.         ^assign -DEOPCNT
  1184.         ^assign -DEOPCHAN
  1185.         ^assign -MCH
  1186.         ^assign -HIGHHOPS
  1187.         ^assign -CTR
  1188.         ^assign -MDOPZ
  1189.         ^assign -DMASK
  1190.         ^on who -
  1191.     }
  1192. }
  1193.  
  1194. # pp.mkick <#channel> <mask> <reason>
  1195. alias pp.mkick {
  1196.     @ KMASK = [$1]
  1197.     ^on ^who * {
  1198.         ^if ((match(*${KMASK}* $1!$3@$4))&&([$1] != N))
  1199.         {
  1200.             ^if (!match($1 $PP.BOTNICKS)) {@ MKZ = [$1 $MKZ]}
  1201.         }
  1202.     }
  1203.     //^who $0
  1204.     @ KCHAN = [$0]
  1205.     @ KREASON = [$2-]
  1206.     wait -CMD if (1) {
  1207.         ^pp.listk $KCHAN $MKZ
  1208.         ^assign -KCHAN
  1209.         ^assign -MKZ
  1210.         ^assign -KMASK
  1211.         ^assign -KREASON
  1212.         ^on who -
  1213.     }
  1214. }
  1215.  
  1216. # pp.mop <#channel> <mask>
  1217. alias pp.mop {
  1218.     @ OPMASK = [$1]
  1219.     ^on ^who * {^if ((!match(*@* $2))&&(match(*${OPMASK}* $1!$3@$4))) {^if ([$1] != N) {@ MOPZ = [$MOPZ $1]}}}
  1220.     //^who $0
  1221.     @ MOPCHAN = [$0]
  1222.     wait -CMD if (1) {
  1223.         ^pp.listm.3 +ooo $MOPCHAN $MOPZ
  1224.         ^assign -MOPCHAN
  1225.         ^assign -MOPZ
  1226.         ^assign -OPMASK
  1227.         ^on ^who -
  1228.     }
  1229. }
  1230.  
  1231. # pp.modev <#channel> <mask> <+/->
  1232. alias pp.modev {
  1233.     @ VMASK = [$1]
  1234.     ^on ^who * {^if (match(*${VMASK}* $1!$3@$4)) {@ MVZ = [$MVZ $1]}}
  1235.     //^who $0
  1236.     @ MVCHAN = [$0]
  1237.     @ MVMODE = [$2]
  1238.     wait -CMD if (1) {
  1239.         ^pp.listm.3 ${MVMODE}vvv $MVCHAN $MVZ
  1240.         ^assign -MVCHAN
  1241.         ^assign -MVMODE
  1242.         ^assign -MVZ
  1243.         ^assign -VMASK
  1244.         ^on ^who -
  1245.     }
  1246. }
  1247.  
  1248. # The user mass commands
  1249. # mdop/mvop/mop/munvop [<mask>]
  1250. alias mdop.1 {^if (gotops($C)) {^if ([$0]) {^pp.mdop $C 1 $0} {^pp.mdop $C 1 *}} {/echo *** You don't have ops on $C}}
  1251. alias mdop.2 {^if (gotops($C)) {^if ([$0]) {^pp.mdop $C 2 $0} {^pp.mdop $C 2 *}} {/echo *** You don't have ops on $C}}
  1252. alias mdop.3 {^if (gotops($C)) {^if ([$0]) {^pp.mdop $C 3 $0} {^pp.mdop $C 3 *}} {/echo *** You don't have ops on $C}}
  1253. alias mdop.4 {^if (gotops($C)) {^if ([$0]) {^pp.mdop $C 4 $0} {^pp.mdop $C 4 *}} {/echo *** You don't have ops on $C}}
  1254. alias mdop {^mdop.4 $*}
  1255. alias mop {^if (gotops($C)) {^if ([$0]) {^pp.mop $C $0} {^pp.mop $C *}} {/echo *** You don't have ops on $C}}
  1256. alias mvop {^if (gotops($C)) {^if ([$0]) {^pp.modev $C $0 +} {^pp.modev $C * +}} {/echo *** You don't have ops on $C}}
  1257. alias munvop {^if (gotops($C)) {^if ([$0]) {^pp.modev $C $0 -} {^pp.modev $C * -}} {/echo *** You don't have ops on $C}}
  1258.  
  1259. # Fast mdop (x4)
  1260. alias fmdop {
  1261.     if (gotops($C))
  1262.     {
  1263.         if (match(*!*@* $0)) {@ UM = [$0]} {@ UM = [*!*@*]}
  1264.         foreach PP.USERS.$encode($tolower($C)) AA {
  1265.             if (decode($AA) != N)
  1266.             {
  1267.                 if ((ischanop($decode($AA) $C))&&(match($UM $decode($AA)!$word(2 $PP.USERS[$encode($tolower($C))][$AA])))) {@ MDOPZ = MDOPZ##[$decode($AA) ]}
  1268.             }
  1269.         }
  1270.         pp.listm.4 -oooo $C $MDOPZ
  1271.         ^assign -MDOPZ
  1272.         ^assign -UM
  1273.     } {/echo *** You don't have ops on $C}
  1274. }
  1275.  
  1276. # op and deop aliases
  1277. # op/deop <nicks>
  1278. alias op {^if ([$0]) {^pp.listm.3 +ooo $C $*} {/echo *** /op <nick> [<nick> ...]}}
  1279. alias deop {^if ([$0]) {^pp.listm.2 -oo $C $*} {/echo *** /deop <nick> [<nick> ...]}}
  1280.  
  1281. # masskick aliases
  1282. # masskick [<reason>] (kicks with mask *)  mkick [<mask>]
  1283. alias masskick {^if (gotops($C)) {^if ([$0]) {^pp.mkick $C * $*} {^pp.mkick $C * [Masskick: *]}} {/echo *** You don't have ops on $C}}
  1284. alias mkick {^if (gotops($C)) {^if ([$0]) {^pp.mkick $C $0 [Masskick: $0]} {^pp.mkick $C * [Masskick: *]}} {/echo *** You don't have ops on $C}}
  1285.  
  1286. # Kicks all non-operators on channel
  1287. alias lkick {
  1288.     if (gotops($C))
  1289.     {
  1290.         ^on ^who * {/if (([$1] != N)&&(!rmatch($2 *@*))) {//kick $0 $1 [Non-Operator Kick]}}
  1291.         //^who *
  1292.         wait -CMD ^on who -
  1293.     } {/echo *** You don't have ops on $C}
  1294. }
  1295.  
  1296. # massdcc <file> [<mask>]
  1297. alias massdcc {
  1298.     if ([$0])
  1299.     {
  1300.         if ([$1]) {@ DCCMASK = [$1]} {@ DCCMASK = [*]}
  1301.         ^on ^who * {^if (([$1] != N)&&(match(*${DCCMASK}* $1!$3@$4))) {@ DCCPPL = [$1 $DCCPPL]}}
  1302.         //^who *
  1303.         @ MDFILE = [$0]
  1304.         wait -CMD if (1) {
  1305.             ^on who -
  1306.             ^pp.listdcc $MDFILE $DCCPPL
  1307.             ^assign -DCCMASK
  1308.             ^assign -DCCPPL
  1309.             echo *** Sent DCC SEND request for $MDFILE to everyone in $C
  1310.             ^assign -MDFILE
  1311.         }
  1312.     } {/echo *** /massdcc <file> [<mask>]}
  1313. }
  1314.  
  1315. # Re-aliased to not require channel names
  1316. alias invite {^if (ischannel($1)) {//invite $*} {//invite $0 $C}}
  1317. alias kick {^if (ischannel($0)) {//kick $*} {//kick $C $0 $1-}}
  1318. alias mode {^if (ischannel($0)) {//mode $*} {^if ([$0] == N) {//mode $*} {//mode $C $*}}}
  1319.  
  1320. # pp.snm old new
  1321. # Snak adaptation 1.3 Snak has integrated highlighting
  1322. #alias pp.snm {
  1323. #    EVAL ^on raw_irc - "% PRIVMSG #% :*$0*"
  1324. #    EVAL ^on ^raw_irc "% PRIVMSG #% :*$1*" {
  1325. #        if (match(*ACTION* $3))
  1326. #        {
  1327. #            if ([$2] == C) {/xecho -window $winnum() -level PUBLIC * $nickonly($0) $strip( $4-)}
  1328. #            {/xecho -window $winnum() -level PUBLIC * $nickonly($0):$2 $strip( $4-)}
  1329. #        }
  1330. #        {
  1331. #            if ([$2] == C) {/xecho -window $winnum() -level PUBLIC <$nickonly($0)> $strip( $mid(1 65535 $3) $4-)}
  1332. #            {/xecho -window $winnum() -level PUBLIC <$nickonly($0):$2> $strip( $mid(1 65535 $3) $4-)}
  1333. #        }
  1334. #    }
  1335. #}
  1336.  
  1337. # Snak adaptation 1.3 Snak has integrated highlighting
  1338. alias nick {
  1339.     ^if ([$0])
  1340.     {
  1341. #        if (PP.SET.PMATCH == [.]) {^pp.snm $strip(_-[] $N) $strip(_-[] $0)}
  1342.         if (PP.DCC) {^dcc.onnick $*}
  1343.         quote NICK $*
  1344.     } {/nick $randcrap(9)}
  1345. }
  1346.  
  1347. # We don't use the -k$M method because of how the mode locking code works
  1348. alias clearmode {
  1349.     if (ischannel($0))
  1350.     {
  1351.         ^on ^324 * {@ CMODE = strip(:+ $2)##[ $3-]}
  1352.         //mode $0
  1353.         @ CMCHAN = [$0]
  1354.         wait -CMD if (1) {
  1355.             ^on 324 -
  1356.             //mode $CMCHAN -k$CMODE
  1357.             ^assign -CMCHAN
  1358.             ^assign -CMODE
  1359.         }
  1360.     } {/clearmode $C}
  1361. }
  1362.  
  1363. # Bans bots and bomb/inverse/beep/etc usernames
  1364. alias botban {//mode $C +bbb *b?t!*@* *srv!*@* *s?rv!*@*}
  1365. alias bot {//bot}
  1366.  
  1367. # pp.clearban <channel> <mask>
  1368. alias pp.clearban {
  1369.     @ BANMASK = [$1]
  1370.     ^on ^raw_irc "% 367 *" {^if ((match(*${BANMASK}* $4))||(match($4 $BANMASK))) {@ CBUNBAND = [$4 $CBUNBAND]}}
  1371.     //mode $0 b
  1372.     wait -CMD if (1) {
  1373.         ^pp.listunban $C $CBUNBAND
  1374.         ^assign -CBUNBAND
  1375.         ^assign -BANMASK
  1376.         ^on raw_irc - "% 367 *"
  1377.     }
  1378. }
  1379.  
  1380. # User clearban alias
  1381. # clearban [<mask>]
  1382. alias clearban {^if ([$0]) {^pp.clearban $C $*} {^pp.clearban $C *}}
  1383.  
  1384. # Unban alias: looks up user's user@host and runs a clearban
  1385. # unban <nick>
  1386. alias unban {
  1387.     if ([$0]) {
  1388.         if (match(*!*@* $0)) {^pp.listunban $C $*}
  1389.         {
  1390.             ^Userhost $0 -CMD if ([$3]) {
  1391.                 if ([$4] != [<UNKNOWN>]) {^pp.clearban $C $0!$3@$4} {/echo *** $0 is not on IRC}
  1392.             }
  1393.         }
  1394.     } {/echo *** /unban <nick/umask>}
  1395. }
  1396.         
  1397. # ban <nick>
  1398. alias ban {
  1399.     if ([$0])
  1400.     {
  1401.         if (match(*!*@* $0)) {//mode $C +bbb $*}
  1402.         {
  1403.             ^Userhost $0 -CMD if ([$3]) {
  1404.                 if ([$4] != [<UNKNOWN>])
  1405.                 {
  1406.                     @ HNAME = [$4]
  1407.                     if ((!isalpha($HNAME))&&(match(*.*.*.* $HNAME))) {@ ST = [*!*$mid(1 1000 $3)@]##left($rindex(. $HNAME) $HNAME)##[.*]}
  1408.                     {@ ST = [*!*$mid(1 1000 $3)@*$right(${@HNAME-index(. $4)} $4)]}
  1409.                     if (PP.SET.FUNKYBANS)
  1410.                     {
  1411.                         @ AA = []
  1412.                         @ CT = 0
  1413.                         while (CT < [$@ST])
  1414.                         {
  1415.                             @ SC = mid($CT 1 $ST)
  1416.                             if ((!match(*${SC}* @!.))&&(SC != [*]))
  1417.                             {
  1418.                                 if (rand(4) == 2) {@ AA = AA##[?]}
  1419.                                 {@ AA = AA##SC}
  1420.                             } {@ AA = AA##SC}
  1421.                             @ CT = CT + 1
  1422.                         }
  1423.                         ^assign -CT
  1424.                         ^assign -SC
  1425.                     } {@ AA = ST}
  1426.                     ^assign -ST
  1427.                     ^assign -HNAME
  1428.                     //mode $C +b $AA
  1429.                 } {/echo *** $0 is not on IRC}
  1430.             }
  1431.         }
  1432.     } {//mode $C b}
  1433. }
  1434.  
  1435. # /wordkick <channel> <word/phrase>
  1436. # or /wordkick <channel> off
  1437. alias wordkick {
  1438.     if ([$1])
  1439.     {
  1440.         if (ischannel($0)) {@ WCHAN = [$0]} {@ WCHAN = [#$0]}
  1441.         if ([$1] == [OFF])
  1442.         {
  1443.             foreach WORDKICKS AA {
  1444.                 if (decode($AA) == [$WCHAN])
  1445.                 {
  1446.                     EVAL ^on raw_irc - "% ??????% $decode($AA) :*$WORDKICKS[$AA]*"
  1447.                     ^assign -WORDKICKS[$AA]
  1448.                     @ WK = 1
  1449.                 }
  1450.             }
  1451.             if (WK) {/echo *** Wordkick for $WCHAN removed} {/echo *** There is no wordkick active on $WCHAN}
  1452.             ^assign -WK
  1453.         }
  1454.         {
  1455.             @ WORDKICKS[$encode($WCHAN)] = [$1-]
  1456.             EVAL ^on -raw_irc "% ??????% $WCHAN :*$1-*" {
  1457.                 //kick $2 $nickonly($0) [Wordkick]
  1458.             }
  1459.             echo *** Wordkick for '$1-' now active on channel $WCHAN
  1460.         }
  1461.         ^assign -WCHAN
  1462.     }
  1463.     {
  1464.         echo *** Active wordkicks:
  1465.         foreach WORDKICKS AA {/echo *** Channel: $[12]decode($AA) Word/phrase: $WORDKICKS[$AA]}
  1466.     }
  1467. }
  1468.  
  1469. # ----------------------------------------------------------------------------
  1470. # Friends and enemies lists handlers
  1471. # ----------------------------------------------------------------------------
  1472.  
  1473. # 'CK' is $encode(*)
  1474.  
  1475. # pp.addl <FRIENDS/ENEMIES> <umask> <channel/*>
  1476. alias pp.addl {
  1477.     if ((!match($1 $PP[$0][$encode($toupper($2))]))&&(!match($1 $PP[$0][CK])))
  1478.     {
  1479.         if (PP[$0][$encode($toupper($2))]) {@ PP[$0][$encode($toupper($2))] = PP[$0][$encode($toupper($2))]##[ $1]} {@ PP[$0][$encode($toupper($2))] = [$1]}
  1480.         if ([$2] == [*]) {/echo *** User mask [$1] added to global $tolower($0) list}
  1481.         {/echo *** User mask [$1] added to $tolower($0) list for channel mask $2}
  1482.     }
  1483.     {
  1484.         if ([$2] == [*]) {/echo *** A user mask matching [$1] is already on your global friends list}
  1485.         {/echo *** A user mask matching [$1] is already on the list for channel mask $2 or the global list}
  1486.     }
  1487. }
  1488. # pp.rml <FRIENDS/ENEMIES> <umask> <channel/*>
  1489. alias pp.rml {
  1490.     if ((match($1 $PP[$0][$encode($toupper($2))]))||(rmatch($1 $PP[$0][$encode($toupper($2))])))
  1491.     {
  1492.         @ CN = encode($toupper($2))
  1493.         @ AA = 0
  1494.         while (word($AA $PP[$0][$CN]))
  1495.         {
  1496.             if ((match($1 $word($AA $PP[$0][$CN])))||(match($word($AA $PP[$0][$CN]) $1)))
  1497.             {
  1498.                 ^delword $word($AA $PP[$0][$CN]) $PP[$0][$CN]
  1499.                 @ PP[$0][$CN] = NLIST
  1500.                 ^assign -NLIST
  1501.                 @ AA = 0
  1502.             } {@ AA = AA + 1}
  1503.         }
  1504.         if (!(word(0 $PP[$0][$CN]))) {^assign -PP[$0][$CN]}
  1505.         ^assign -CN
  1506.         if ([$2] == [*]) {/echo *** All patterns matching [$1] removed from global $tolower($0) list}
  1507.         {/echo *** All patterns matching [$1] removed from list for channel mask $2}
  1508.     }
  1509.     {
  1510.         if ([$2] == [*]) {/echo *** No patterns matching [$1] are on your global friends list}
  1511.         {/echo *** No patterns matching [$1] are on the list for channel mask $2 or the global list}
  1512.     }
  1513. }
  1514. # pp.rmlall <FRIENDS/ENEMIES> <umask>
  1515. alias pp.rmlall {
  1516.     EVAL ^foreach PP.$0 AB {
  1517.         if ((match($1 $PP[$0][$AB]))||(rmatch($1 $PP[$0][$AB]))) {^pp.rml $0 $1 $tolower($decode($AB))}
  1518.     }
  1519. }
  1520.  
  1521. # /friend <nick/umask> [<channel mask>]
  1522. alias friend {
  1523.     if ([$0])
  1524.     {
  1525.         if (match(*!*@* $0)) {^if ([$1]) {/pp.addl FRIENDS $0 $1} {/pp.addl FRIENDS $0 *}}
  1526.         {
  1527.             if ([$1]) {@ AA = [$1]} {@ AA = [*]}
  1528.             ^Userhost $0 -CMD if ([$3]) {
  1529.                 if ([$4] != [<UNKNOWN>])
  1530.                 {
  1531.                     @ UHOST = [$mid(1 $index(@ $3@$4) $mid(${index(! $3@$4)+1} 1000 $3@$4))*$mid(${index(. $3@$4)+1} 1000 $3@$4)]
  1532.                     ^pp.addl FRIENDS *!*$UHOST $AA
  1533.                     ^alias echo {}
  1534.                     ^pp.rml ENEMIES *!*$UHOST $AA
  1535.                     ^alias -echo
  1536.                     ^assign -UHOST
  1537.                     if (index(W $PP.SET) >= 0) {//^notice $0 [PurePak] You have been added to my friends list for channels matching [${AA}]: type /ctcp $N HELP for functions available to you}
  1538.                 } {/echo *** $0 is not on IRC}
  1539.             }
  1540.         }
  1541.     } {/echo *** /friend <nick/umask> [<channel mask>] (can contain wildcards)}
  1542. }
  1543. # /enemy <nick/umask> [<channel mask>]
  1544. alias enemy {
  1545.     if ([$0])
  1546.     {
  1547.         if (match(*!*@* $0)) {^if ([$1]) {/pp.addl ENEMIES $0 $1} {/pp.addl ENEMIES $0 *}}
  1548.         {
  1549.             if ([$1]) {@ AA = [$1]} {@ AA = [*]}
  1550.             ^Userhost $0 -CMD if ([$3]) {
  1551.                 if ([$4] != [<UNKNOWN>])
  1552.                 {
  1553.                     @ UHOST = [$mid(1 $index(@ $3@$4) $mid(${index(! $3@$4)+1} 1000 $3@$4))*$mid(${index(. $3@$4)+1} 1000 $3@$4)]
  1554.                     ^pp.addl ENEMIES *!*$UHOST $AA
  1555.                     ^alias echo {}
  1556.                     ^pp.rml FRIENDS *!*$UHOST $AA
  1557.                     ^alias -echo
  1558.                     ^assign -UHOST
  1559.                 } {/echo *** $0 is not on IRC}
  1560.             }
  1561.         }
  1562.     } {/echo *** /enemy <nick/umask> [<channel mask>] (can contain wildcards)}
  1563. }
  1564.  
  1565. # /rmfriend <nick/umask> [<channel mask>]
  1566. alias rmfriend {
  1567.     if ([$0])
  1568.     {
  1569.         if (match(*!*@* $0)) {^if ([$1]) {/pp.rml FRIENDS $0 $1} {/pp.rmlall FRIENDS $0}}
  1570.         {
  1571.             if ([$1]) {@ AA = [$1]} {@ AA = [AA]}
  1572.             ^Userhost $0 -CMD if ([$3]) {
  1573.                 if ([$4] != [<UNKNOWN>])
  1574.                 {
  1575.                     @ UHOST = [$mid(1 $index(@ $3@$4) $mid(${index(! $3@$4)+1} 1000 $3@$4))*$mid(${index(. $3@$4)+1} 1000 $3@$4)]
  1576.                     if (AA == [AA]) {^pp.rmlall FRIENDS *!*$UHOST} {^pp.rml FRIENDS *!*$UHOST $AA}
  1577.                     ^assign -UHOST
  1578.                 } {/echo *** $0 is not on IRC}
  1579.             }
  1580.         }
  1581.     } {/echo *** /rmfriend <nick/umask> [<channel mask>] (can contain wildcards)}
  1582. }
  1583. # /rmenemy <nick/umask> [<channel mask>]
  1584. alias rmenemy {
  1585.     if ([$0])
  1586.     {
  1587.         if (match(*!*@* $0)) {^if ([$1]) {/pp.rml ENEMIES $0 $1} {/pp.rmlall ENEMIES $0}}
  1588.         {
  1589.             if ([$1]) {@ AA = [$1]} {@ AA = [AA]}
  1590.             ^Userhost $0 -CMD if ([$3]) {
  1591.                 if ([$4] != [<UNKNOWN>])
  1592.                 {
  1593.                     @ UHOST = [$mid(1 $index(@ $3@$4) $mid(${index(! $3@$4)+1} 1000 $3@$4))*$mid(${index(. $3@$4)+1} 1000 $3@$4)]
  1594.                     if (AA == [AA]) {^pp.rmlall ENEMIES *!*$UHOST} {^pp.rml ENEMIES *!*$UHOST $AA}
  1595.                     ^assign -UHOST
  1596.                 } {/echo *** $0 is not on IRC}
  1597.             }
  1598.         }
  1599.     } {/echo *** /rmenemy <nick/umask> [<channel mask>] (can contain wildcards)}
  1600. }
  1601.  
  1602. alias nofriends {/rmfriend *!*@*}
  1603. alias noenemies {/rmenemy *!*@*}
  1604.  
  1605. alias lsfriends {
  1606.     echo *** Channel Mask   Patterns
  1607.     if (PP.FRIENDS.CK) {/echo *** [Global (*)]   $PP.FRIENDS.CK}
  1608.     foreach PP.FRIENDS AA {
  1609.         if (AA != [CK])
  1610.         {
  1611.             @ CM = tolower($decode($AA))
  1612.             echo *** $[14]CM $PP.FRIENDS[$AA]
  1613.         }
  1614.     }
  1615.     ^assign -CM
  1616. }
  1617. alias lsenemies {
  1618.     echo *** Channel Mask   Patterns
  1619.     if (PP.ENEMIES.CK) {/echo *** [Global (*)]   $PP.ENEMIES.CK}
  1620.     foreach PP.ENEMIES AA {
  1621.         if (AA != [CK])
  1622.         {
  1623.             @ CM = tolower($decode($AA))
  1624.             echo *** $[14]CM $PP.ENEMIES[$AA]
  1625.         }
  1626.     }
  1627.     ^assign -CM
  1628. }
  1629.  
  1630. # ----------------------------------------------------------------------------
  1631. # Miscellaneous user aliases
  1632. # ----------------------------------------------------------------------------
  1633.  
  1634. # pp.mmsg <PRIVMSG/NOTICE> <who status match> <msg>
  1635. alias pp.mmsg {
  1636.     @ STATP = [$1]
  1637.     ^on ^who * {^if (([$1] != N)&&(match($STATP $2))) {@ MSGNICKS = [$1 ]##MSGNICKS}}
  1638.     @ SEND_TYPE = [$0]
  1639.     @ SEND_MSG = [$2-]
  1640.     //^who *
  1641.     wait -CMD if (1) {
  1642.         ^on who -
  1643.         ^pp.listmsg $SEND_TYPE $MSGNICKS
  1644.         if (SEND_TYPE == [NOTICE])
  1645.         {
  1646.             @ EC.1 = [-]
  1647.             @ EC.2 = [-]
  1648.         }
  1649.         {
  1650.             @ EC.1 = [[]
  1651.             @ EC.2 = []]
  1652.         }
  1653.         if (STATP == [*@*]) {/echo -> ${EC.1}OPS@$C${EC.2} $SEND_MSG} {/echo -> ${EC.1}*@$C${EC.2} $SEND_MSG}
  1654.         ^assign -EC.1
  1655.         ^assign -EC.2
  1656.         ^assign -SEND_TYPE
  1657.         ^assign -SEND_MSG
  1658.         ^assign -MSGNICKS
  1659.         ^assign -STATP
  1660.     }
  1661. }
  1662.  
  1663. # Mass msg'ing aliases
  1664. alias msgall {^if ([$0]) {^pp.mmsg PRIVMSG * $*} {/echo *** /msgall <msg>}}
  1665. alias msgops {^if ([$0]) {^pp.mmsg PRIVMSG *@* $*} {/echo *** /msgops <msg>}}
  1666. alias wallops {^if ([$0]) {^pp.mmsg NOTICE *@* [WallOps:${C}] $*} {/echo *** /wallops <msg> (Use //wallops to use IRC's original wallops command)}}
  1667. alias wall {/wallops $*}
  1668.  
  1669. # So that help servers won't trigger flood protection
  1670. alias help {
  1671.     EVAL ^on -flood "$help_service *" {}
  1672.     EVAL ^timer 60 ^on flood - "$help_service *"
  1673.     //help $*
  1674. }
  1675.  
  1676. alias finger {
  1677.     if ([$0])
  1678.     {
  1679.         if (match(*@* $0)) {/exec $PP.SET.FINGERCMD $0}            
  1680.         {
  1681.             ^Userhost $0 -CMD if ([$3]) {^if ([$3] != [<UNKNOWN>]) {/exec $PP.SET.FINGERCMD $strip(~ $3)@$4} {/echo *** $0 is not on IRC}}
  1682.         }
  1683.     } {/echo *** /finger <nick> -or- /finger <user@host>}
  1684. }
  1685.  
  1686. # Uncompressing /load command
  1687. on ^exec "uncomp *" {/echo *** Output from uncompress program: $1-}
  1688. alias load {
  1689.     if ([$0])
  1690.     {
  1691.         if (right(3 $0) == [.gz]) {@ COMPRESS.ISCOMP = PP.SET.UNGZCMD}
  1692.         if (right(2 $0) == [.Z]) {@ COMPRESS.ISCOMP = PP.SET.UNZCMD}
  1693.         if (COMPRESS.ISCOMP)
  1694.         {
  1695.             ^set input_prompt [$0] Uncompressing and loading...
  1696.             @ COMPRESS.PIPENAME = [/tmp/pptmp]##rand(99999999)
  1697.             @ CMPFILE = [$0]
  1698.             exec -name mknod $PP.SET.MKNODCMD $COMPRESS.PIPENAME p
  1699.             wait -CMD %mknod if (1) {
  1700.                 exec -name uncomp $COMPRESS.ISCOMP $CMPFILE >>$COMPRESS.PIPENAME
  1701.                 //load $COMPRESS.PIPENAME
  1702.                 exec -name rm $PP.SET.RMCMD $COMPRESS.PIPENAME
  1703.                 ^assign -CMPFILE
  1704.                 ^assign -COMPRESS.PIPENAME
  1705.                 ^assign -COMPRESS.ISCOMP
  1706.                 ^set -input_prompt
  1707.             }
  1708.         }
  1709.         {
  1710.             ^set input_prompt [$0] Loading...
  1711.             //load $*
  1712.             ^set -input_prompt
  1713.         }
  1714.     } {//load}
  1715. }
  1716.  
  1717. alias names {^if ([$0]) {//names $*} {/if (ischannel($C)) {//names $C}}}
  1718. alias chops {^if ([$0]) {/who $0 -chops} {/who $C -chops}}
  1719.  
  1720. alias bk {
  1721.     if ([$0])
  1722.     {
  1723.         ^ban $0
  1724.         @ KN = [$0]
  1725.         ^assign KR $1-
  1726.         wait -CMD if (1) {
  1727.             //^kick $C $KN $KR
  1728.             ^assign -KN
  1729.             ^assign -KR
  1730.         }
  1731.     } {/echo *** /bk <nick> [<reason>]}
  1732. }
  1733.  
  1734. alias leave {^if ([$0]) {^if (ischannel($0)) {//leave $*} {//leave #$*}} {//leave $C}}
  1735. alias part {/leave $*}
  1736. alias join {^if ((ischannel($0))||(match(-* $0))) {//join $*} {//join #$*}}
  1737.  
  1738. # Yet another command that is destined to show up in tons of other scripts :)
  1739. # /avoid <nick> or /avoid - <nick> ... just /avoid displays a list
  1740. alias avoid {
  1741.     if ([$0])
  1742.     {
  1743.         if ([$0] == [-])
  1744.         {
  1745.             if ([$1])
  1746.             {
  1747.                 if (match($1 $PP.SET.AVOID))
  1748.                 {
  1749.                     ^delword $1 $PP.SET.AVOID
  1750.                     @ PP.SET.AVOID = NLIST
  1751.                     ^assign -NLIST
  1752.                     echo *** Nick $1 removed from aviodance list
  1753.                 }
  1754.                 {
  1755.                     if ([$1] == [*])
  1756.                     {
  1757.                         ^assign -PP.SET.AVOID
  1758.                         echo *** Avoidance list cleared
  1759.                     } {/echo *** Nick $1 is not on your avoidance list}
  1760.                 }
  1761.             } {/echo *** /avoid - <nick>}
  1762.         }
  1763.         {
  1764.             if (match($1 $PP.SET.AVOID)) {/echo *** Nick $0 is already on your avoidance list}
  1765.             {
  1766.                 @ PP.SET.AVOID = PP.SET.AVOID##[$0 ]
  1767.                 echo *** Nick $0 added to avoidance list
  1768.                 if (!match($0 $PP.SET.NOTIFY)) {^notify $0}
  1769.             }
  1770.         }
  1771.     } {/echo *** Avoidance list: $PP.SET.AVOID}
  1772. }
  1773.  
  1774. alias cstats {
  1775.     @ CSOPS = 0
  1776.     @ CSNOPS = 0
  1777.     @ CSOPERS = 0
  1778.     @ CSHERE = 0
  1779.     @ CSGONE = 0
  1780.     @ CSUCOUNT = 0
  1781.     @ CSFARTHEST = 0
  1782.     ^on ^who * {
  1783.         if (match(*@* $2)) {@ CSOPS = CSOPS + 1} {@ CSNOPS = CSNOPS + 1}
  1784.         if ((mid(1 1 $2) == [*])||(mid(2 1 $2) == [*])) {@ CSOPERS = CSOPERS + 1}
  1785.         if (match(*H* $2)) {@ CSHERE = CSHERE + 1} {@ CSGONE = CSGONE + 1}
  1786.         @ CSUCOUNT = CSUCOUNT + 1
  1787.         if ([$5] > CSFARTHEST) {@ CSFARTHEST = [$5]}
  1788.     }
  1789.     if (ischannel($0)) {@ CSCHAN = [$0]} {@ CSCHAN = C}
  1790.     //^who $CSCHAN
  1791.     wait -CMD if (1) {
  1792.         ^on who -
  1793.         echo *** Stats for channel ${CSCHAN}:
  1794.         echo *** Total Users:${CSUCOUNT}   Ops:${CSOPS}   Non-ops:${CSNOPS}   IRCOps:${CSOPERS}
  1795.         echo *** Here:${CSHERE}   Away:${CSGONE}   Server hops to farthest user:${CSFARTHEST}
  1796.         ^assign -CSOPS
  1797.         ^assign -CSNOPS
  1798.         ^assign -CSCHAN
  1799.         ^assign -CSOPERS
  1800.         ^assign -CSHERE
  1801.         ^assign -CSGONE
  1802.         ^assign -CSUCOUNT
  1803.         ^assign -CSFARTHEST
  1804.     }
  1805. }
  1806.  
  1807. # We alias the notify list so we can keep track of it and save it with /sve
  1808. alias pp.notifychk {
  1809.     if ([$0] == [-]) {^assign -PP.SET.NOTIFY}
  1810.     {
  1811.         @ AA = 0
  1812.         while (word($AA $*))
  1813.         {
  1814.             if (match(-* $word($AA $*)))
  1815.             {
  1816.                 if (PP.SET.NOTIFY)
  1817.                 {
  1818.                     ^delword $mid(1 1000 $word($AA $*)) $PP.SET.NOTIFY
  1819.                     @ PP.SET.NOTIFY = NLIST
  1820.                     ^assign -NLIST
  1821.                 }
  1822.             }
  1823.             {
  1824.                 if (!match($word($AA $*) $PP.SET.NOTIFY)) {@ PP.SET.NOTIFY = PP.SET.NOTIFY##[$word($AA $*) ]}
  1825.             }
  1826.             @ AA = AA + 1
  1827.         }
  1828.     }
  1829. }
  1830. alias notify {
  1831.     //notify $*
  1832.     if ([$0]) {^pp.notifychk $*}
  1833. }
  1834.  
  1835. alias version {
  1836.     if ([$0]) {^if (match(*.* $0)) {//version $*} {//ctcp $0 VERSION}}
  1837.     {
  1838.         //version
  1839.         echo *** PurePak: version $PPVERS
  1840.     }
  1841. }
  1842.  
  1843. alias rwhois {^if ([$0]) {/whois $0 $0} {/whois $N}}
  1844. alias whois {
  1845.     @ WHOISINPROGRESS = 1
  1846.     //whois $*
  1847.     wait -CMD if (1) {^timer 2 ^assign -WHOISINPROGRESS}
  1848. }
  1849.  
  1850. # /nslookup <nick> or /nslookup <ip address>
  1851. alias nslookup {
  1852.     if ([$0])
  1853.     {
  1854.         if (match(*.* $0)) {^pp.dolookup $0}
  1855.         {
  1856.             ^Userhost $0 -CMD if ([$3]) {
  1857.                 if ([$4] != [<UNKNOWN>])
  1858.                 {
  1859.                     if (!isalpha($4)) {^pp.dolookup $4}
  1860.                     {/echo *** $0 is not online as an IP address}
  1861.                 } {/echo *** $0 is not on IRC}
  1862.             }
  1863.         }
  1864.     } {/echo *** /nslookup <nick> -or- /nslookup <ip address>}
  1865. }
  1866. alias pp.dolookup {
  1867.     if (!LOOKINGUP)
  1868.     {
  1869.         exec -name NSLOOKUP $PP.SET.NSLOOKCMD $0
  1870.         @ IPAD = [$0]
  1871.         @ LOOKINGUP = 1
  1872.     }
  1873. }
  1874. on ^exec "NSLOOKUP *" {}
  1875. on ^exec_error "NSLOOKUP *" {}
  1876. on ^exec "NSLOOKUP *Name*" {^pp.gn $*}
  1877. on ^exec_error "NSLOOKUP *Name*" {^pp.gn $*}
  1878. on ^exec_exit "NSLOOKUP *" {
  1879.     if (NSHOST) {/echo *** $IPAD is ${NSHOST}} {/echo *** Could not resolve a hostname for $IPAD}
  1880.     ^assign -NSHOST
  1881.     ^assign -IPAD
  1882.     ^assign -LOOKINGUP
  1883. }
  1884. alias pp.gn {
  1885.     @ AA = 0
  1886.     while (word($AA $*))
  1887.     {
  1888.         if (match(*.* $word($AA $*))) {@ NSHOST = word($AA $*)}
  1889.         @ AA = AA + 1
  1890.     }
  1891. }
  1892.  
  1893. alias ig {
  1894.     if ([$0])
  1895.     {
  1896.         ^Userhost $0 -CMD if ([$3]) {
  1897.             if ([$4] != [<UNKNOWN>]) {/ignore *$strip(~ $3)@$4 MSG NOTICE CTCP PUBLIC} {/echo *** $0 is not on IRC}
  1898.         }
  1899.     } {/echo *** /ig <nick>}
  1900. }
  1901. alias unig {
  1902.     if ([$0])
  1903.     {
  1904.         ^Userhost $0 -CMD if ([$3]) {
  1905.             if ([$4] != [<UNKNOWN>]) {/ignore *$strip(~ $3)@$4 NONE} {/echo *** $0 is not on IRC}
  1906.         }
  1907.     } {/echo *** /unig <nick>}
  1908. }
  1909. # Snak adaptation 1.2. Snaks ischanop is correct and these checks take time
  1910. # Snak adaptation 1.4. Don't reformat /who output - take out alias aw
  1911. alias who {
  1912.     if ((!DOINGWHO)&&(!SYNCING))
  1913.     {
  1914. #        ^on ^who * {
  1915. #            @ PP.USERS[$WINNUM()][$encode($tolower($0))][$encode($tolower($1))] = [$0 $1 $3@$4]
  1916. #            if (match(*@* $2))
  1917. #            {
  1918. #                if ((!ischanop($1 $0))&&(!PP.ICWARNED))
  1919. #                {
  1920. #                    echo *** Warning: your client's ischanop() function is inaccurate \($1 is op, ischanop() reports not op\)\; channel op status on /users lists may be wrong
  1921. #                    @ PP.ICWARNED = 1
  1922. #                }
  1923. #            }
  1924. #            {
  1925. #                if ((ischanop($1 $0))&&(!PP.ICWARNED))
  1926. #                {
  1927. #                    echo *** Warning: your client's ischanop() function is inaccurate \($1 is not op, ischanop() reports op\)\; channel op status on /users lists may be wrong
  1928. #                    @ PP.ICWARNED = 1~
  1929. #                }
  1930. #            }
  1931. #            aw $*
  1932. #        }
  1933. #        ^if (!PP.EPIC) {^alias aw {/xecho -level CRAP $[10]0 $[9]1 $[3]2 [$[2]5]  $3@$4 \($6-\)}}
  1934. #        {^alias aw {/xecho -level CRAP $[10]0 $[9]1 $[3]2 [$[2]6]  $3@$4 \($7-\)}}
  1935.         if ([$0]) {//who $*} {//who *}
  1936. #        @ DOINGWHO = 1
  1937. #        ^wait -CMD if (1) {
  1938. #            ^alias -aw
  1939. #            ^on who -
  1940. #            ^assign -DOINGWHO
  1941. #        }
  1942.     } {^if (SYNCING) {/echo *** /users synchronization in progress\; try again in a few seconds}}
  1943. }
  1944.  
  1945. alias serv {//server $*}
  1946. alias umode {//mode $N $*}
  1947.  
  1948. # Unflash command that should work on ALL clients
  1949. alias unflash {
  1950.     if (V <= 19930629)
  1951.     {
  1952.         ^set status_clock c
  1953.         ^type ^L
  1954.         ^set status_clock \;\24r
  1955.         ^type ^L
  1956.         ^set status_clock m
  1957.         ^type ^L
  1958.         ^set status_clock ?5l
  1959.         ^type ^L
  1960.         sleep 1
  1961.         ^set status_clock  %T
  1962.         ^type ^L
  1963.         echo *** Screen restored
  1964.     }
  1965.     {
  1966.         if ([$TTY])
  1967.         {
  1968.             if (match(*/* $TTY)) {^assign MYTTY $TTY} {^assign MYTTY /dev/$TTY}
  1969.             ^exec -name unflash echo c >>$MYTTY
  1970.             ^exec -name unflash echo \\\;\24r >>$MYTTY
  1971.             ^exec -name unflash echo m >>$MYTTY
  1972.             ^exec -name unflash echo ?5l >>$MYTTY
  1973.             ^exec -name unflash reset >>$MYTTY
  1974.             wait -CMD %unflash if (1) {
  1975.                 ^type ^L
  1976.                 ^assign -MYTTY
  1977.                 echo *** Screen restored
  1978.             }
  1979.         } {/echo *** UNFLASH FAILED: ENVIRONMENT VARIABLE 'TTY' MUST BE SET TO YOUR TTY.  SEE README.PPK}
  1980.     }
  1981. }
  1982.  
  1983. alias mail {
  1984.     if ([$0])
  1985.     {
  1986.         ^assign MAILFILE $1-
  1987.         ^Userhost $0 -CMD if ([$3]) {
  1988.             if ([$3] != [<UNKNOWN>])
  1989.             {
  1990.                 exec $PP.SET.MAILCMD $strip(~ $3)@$4 < $MAILFILE
  1991.                 echo *** Mailed $MAILFILE to $strip(~ $3)@$4
  1992.                 ^assign -MAILFILE
  1993.             } 
  1994.             {
  1995.                 echo *** $0 is not on IRC
  1996.                 ^assign -MAILFILE
  1997.             }
  1998.         }
  1999.     } {/echo *** /mail <nick> <file>}
  2000. }
  2001. alias uumail {
  2002.     if ([$0]) {
  2003.         ^assign MAILFILE $1-
  2004.         ^Userhost $0 -CMD if ([$3]) {
  2005.             if ([$3] != [<UNKNOWN>])
  2006.             {
  2007.                 exec $PP.SET.UUECMD $MAILFILE $MAILFILE | $PP.SET.MAILCMD $strip(~ $3)@$4
  2008.                 echo *** Mailed $MAILFILE to $strip(~ $3)@$4 (uuencoded)
  2009.                 ^assign -MAILFILE
  2010.             }
  2011.             {
  2012.                 echo *** $0 is not on IRC
  2013.                 ^assign -MAILFILE
  2014.             }
  2015.         }
  2016.     } {/echo *** /uumail <nick> <file>}
  2017. }
  2018.  
  2019. alias topic {^if (ischannel($0)) {//topic $*} {//topic $C $*}}
  2020.  
  2021. alias net {
  2022.     if ([$0])
  2023.     {
  2024.         echo *** Creating a window on server $0
  2025.         echo *** Type ^W to switch between windows and /wk to kill the current window.
  2026.         window new
  2027.         if ([$1]) {/EVAL window server $0:$1::_$N} {/EVAL window server $0:6667::_$N}
  2028.     }
  2029.     {
  2030.         echo *** /net <server> [<port>]
  2031.         echo ***
  2032.         echo *** /net creates a new window and connects it to <server>.  To
  2033.         echo *** switch windows, hit ^W
  2034.         echo ***
  2035.         echo *** /wk kills the current window.
  2036.         echo *** /wh hides the current window.
  2037.         echo *** /ws shows all windows.
  2038.     }
  2039. }
  2040. alias wk {/window kill}
  2041. alias wh {/window hide}
  2042. alias ws {
  2043.     window show 2
  2044.     window show 1
  2045.     window balance
  2046. }
  2047.  
  2048. alias massinv {
  2049.     if ([$0])
  2050.     {
  2051.         ^on ^who * {
  2052.             if (([$1] != N)&&([$0] != C)) {/EVAL ^timer $rand(30) //invite $1 $C}
  2053.         }
  2054.         echo *** Inviting users found with command '/who $*' to channel $C
  2055.         //^who $*
  2056.         wait -CMD ^on who -
  2057.     } {/echo *** /massinv <who params>   - Where <who params> is exactly as if it were a /who command.}
  2058. }
  2059.     
  2060. alias cycle {lj}
  2061. alias lj {
  2062.     @ OC = C
  2063.     //leave $C
  2064.     wait -CMD if (1) {
  2065.         //join $OC
  2066.         ^assign -OC
  2067.     }
  2068. }
  2069.  
  2070. alias signoff {
  2071.     if ([$0])
  2072.     {
  2073.         echo *** Signoff: $N \($*\)
  2074.         //signoff $*
  2075.     }
  2076.     {
  2077.         echo *** Signoff: $N \(Leaving\)
  2078.         //signoff Leaving
  2079.     }
  2080. }
  2081. alias exit {/signoff $*}
  2082. alias quit {/signoff $*}
  2083. alias bye {/signoff $*}
  2084.  
  2085. alias ls {/exec $PP.SET.LSCMD $*}
  2086. alias lsw {
  2087.     @ OLDTABMAX = TAB_MAX
  2088.     ^set TAB_MAX 64
  2089.     exec -name lsw $PP.SET.LSWCMD $*
  2090.     wait -CMD %lsw if (1) {
  2091.         ^set TAB_MAX $OLDTABMAX
  2092.         ^assign -OLDTABMAX
  2093.     }
  2094. }
  2095. alias rm {^if ([$0]) {/exec $PP.SET.RMCMD $*} {/echo *** /rm [<rm options>] <filenames>}}
  2096. alias cat {^if ([$0]) {/exec $PP.SET.CATCMD $*} {/echo *** /cat <filename>}}
  2097. on ^exec "MSGCAT *" {
  2098.     if (!match(=* $MCAT))
  2099.     {
  2100.         ^timer $MCATCTR //msg $MCAT $1-
  2101.         @ MCATCTR = MCATCTR + (rand(2) + 1)
  2102.     } {//msg $MCAT $1-}
  2103. }
  2104. on ^exec_exit "MSGCAT *" {
  2105.     ^assign -MCAT
  2106.     ^assign -MCATCTR
  2107. }
  2108. alias catto {
  2109.     if ([$1])
  2110.     {
  2111.         @ MCAT = [$0]
  2112.         @ MCATCTR = 2
  2113.         exec -name MSGCAT $PP.SET.CATCMD $1
  2114.     }
  2115.     {^if ([$0]) {/catto $C $0} {/echo *** /catto <nick/channel> <file> -or- /catto <file> (goes to current channel)}}
  2116. }
  2117. alias ps {/exec $PP.SET.PSCMD $*}
  2118. alias pskill {^if ([$0]) {/exec $PP.SET.KILLCMD $*} {/echo *** /pskill <pid(s) to kill>}}
  2119.  
  2120. alias pp.awaylog {
  2121.     ^assign AWAYLOG[$PP.AWAYLCTR] $*
  2122.     if (PBFILE) {^pp.playback $*}
  2123.     @ PP.AWAYLCTR = PP.AWAYLCTR + 1
  2124. }
  2125. alias pp.pe {^if (PBFILE) {^msg %pbfile $strip( $*)} {/echo $*}}
  2126. alias pp.playback {
  2127.     if ([$1] == [MSG]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] [$3!$strip(~ $2)] $4-}
  2128.     if ([$1] == [NOTICE]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] -$3!$strip(~ $2)- $4-}
  2129.     if ([$1] == [KICK]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] Kicked from $4 by $3 [$strip(~ $2)] \($5-\)}
  2130.     if ([$1] == [BAN]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] $3 [$strip(~ $2)] banned you from $4 with bans: $5-}
  2131.     if ([$1] == [FLOOD]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] $4- from $3 [$strip(~ $2)] detected}
  2132.     if ([$1] == [DEOP]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] $3 [$strip(~ $2)] deopped you on $4}
  2133.     if ([$1] == [OP]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] $3 [$strip(~ $2)] opped you on $4}
  2134.     if ([$1] == [DCC]) {/pp.pe [$word(1 $stime($0)) $word(2 $stime($0)) $word(3 $stime($0))] DCC $4 \($5\) received from $2 [$strip(~ $3)]}
  2135. }
  2136. alias playback {
  2137.     if (AWAYLOG[0])
  2138.     {
  2139.         if (PBFILE)
  2140.         {
  2141.             @ PBFILE_OLD = PBFILE
  2142.             ^assign -PBFILE
  2143.         }
  2144.         @ CTR = 0
  2145.         ^pp.pauseset
  2146.         while (CTR <= PP.AWAYLCTR)
  2147.         {
  2148.             ^pp.playback $AWAYLOG[$CTR]
  2149.             @ CTR = CTR + 1
  2150.         }
  2151.         ^pp.pauseend
  2152.         ^assign -CTR
  2153.         if (PBFILE_OLD)
  2154.         {
  2155.             @ PBFILE = PBFILE_OLD
  2156.             ^assign -PBFILE_OLD
  2157.         }
  2158.     } {/echo *** No messages or events to play back}
  2159. }
  2160. alias clearlog {
  2161.     foreach AWAYLOG AA {^assign -AWAYLOG[$AA]}
  2162.     @ PP.AWAYLCTR = 0
  2163.     echo *** Away log is now empty
  2164. }
  2165.             
  2166. alias away {
  2167.     if (!(A))
  2168.     {
  2169.         if ([$0]) {//away $*}
  2170.         {
  2171.             if (index(G $PP.SET) >= 0) {//away All messages will be logged...} {//away Gone...}
  2172.         }
  2173.         wait -CMD if (1) {
  2174.             if ((!!(C))&&(index(O $PP.SET) >= 0))
  2175.             {
  2176.                 ^assign SEND_MSG ACTION is away: ${A}
  2177.                 ^pp.listmsg PRIVMSG $mychannels()
  2178.                 ^assign -SEND_MSG
  2179.                 echo * $N is away: $A
  2180.             }
  2181.         }
  2182.         if (index(H $PP.SET) >= 0)
  2183.         {
  2184.             ^assign PBFILE $PP.SET.ALFILE
  2185.             ^exec -name pbfile $PP.SET.CATCMD >>$PBFILE
  2186.             echo *** Away log file ${PBFILE} opened
  2187.         }
  2188.         @ PP.AWAYSINCE = Z
  2189.     }
  2190.     {
  2191.         //away
  2192.         wait -CMD if (1) {
  2193.             ^assign -PP.AWAYSINCE
  2194.             if (index(G $PP.SET) >= 0) {/echo *** Type /playback to play back away log, type /clearlog to clear away log.}
  2195.             if ((!!(C))&&(index(O $PP.SET) >= 0))
  2196.             {
  2197.                 ^assign SEND_MSG ACTION is back.
  2198.                 ^pp.listmsg PRIVMSG $mychannels()
  2199.                 ^assign -SEND_MSG
  2200.                 echo * $N is back.
  2201.             }
  2202.         }
  2203.         if (index(H $PP.SET) >= 0)
  2204.         {
  2205.             ^exec -close %pbfile
  2206.             echo *** Away log file ${PBFILE} closed
  2207.             ^assign -PBFILE
  2208.         }
  2209.     }
  2210. }
  2211.  
  2212. # paway <nick> <msg/->
  2213. alias paway {
  2214.     if ([$0])
  2215.     {
  2216.         if ([$1])
  2217.         {
  2218.             if ([$1] == [-])
  2219.             {
  2220.                 ^assign -PP.PAWAYS[$encode($toupper($0))]
  2221.                 echo *** Personal away message for $0 removed
  2222.             }
  2223.             {
  2224.                 @ PP.PAWAYS[$encode($toupper($0))] = [$1-]
  2225.                 echo *** Personal away message for $0 added: $1-
  2226.             }
  2227.         }
  2228.         {
  2229.             if (PP.PAWAYS[$encode($toupper($0))]) {/echo *** Personal away message for $0: $PP.PAWAYS[$encode($toupper($0))]}
  2230.             {/echo *** No personal away message set for $0}
  2231.         }
  2232.     }
  2233.     {
  2234.         echo *** Nick       Message
  2235.         foreach PP.PAWAYS AA {/echo *** $[10]decode($AA) $PP.PAWAYS[$AA]}
  2236.     }
  2237. }
  2238.  
  2239. alias write {/comment $write($*)}
  2240. # Snak adaptation 1.7 use "log_extrainfo off" to prevent Snak from writing "server:" or "info:" before each line when logging
  2241. alias sve {
  2242.     if (!(HOME))
  2243.     {
  2244.         exec -name rm $PP.SET.RMCMD $PP.SAVEFILE
  2245.         echo *** Warning: Your home directory could not be determined.  Your saved settings file will be saved to the current working directory.  If this isn't your home directory, PurePak may not be able to find it's saved settings file at startup!
  2246.     } {/exec -name rm $PP.SET.RMCMD ${HOME}/$PP.SAVEFILE}
  2247.     wait -CMD %rm if (1) {
  2248.         if (PP.EPIC)
  2249.         {
  2250.             if (!(HOME)) {@ FHANDLE = open($PP.SAVEFILE w)} {@ FHANDLE = open(${HOME}/$PP.SAVEFILE w)}
  2251.             if (FHANDLE > 0) {/EVAL ^assign WM /write $FHANDLE}
  2252.             {
  2253.                 echo *** Could not open target file!
  2254.                 @ WM = [/comment]
  2255.             }
  2256.         }
  2257.         {
  2258.             @ WM = [/xecho -WINDOW WRITEOUT]
  2259.             ^window new
  2260.             ^window log_extrainfo off
  2261.             ^window hold_mode off
  2262.             ^window name WRITEOUT
  2263.             if (!(HOME)) {^window logfile $PP.SAVEFILE} {^window logfile ${HOME}/$PP.SAVEFILE}
  2264.             ^window log on
  2265.         }
  2266.         $WM # PurePak version $PPVERS saved settings file
  2267.         $WM # Written $stime($time())
  2268.         foreach PP.SET AA {$WM @ PP.SET.$AA = [$PP.SET[$AA]]}
  2269.         foreach PP.PAWAYS AA {$WM @ PP.PAWAYS.$AA = [$PP.PAWAYS[$AA]]}
  2270.         $WM @ PP.SET = [$PP.SET]
  2271.         $WM ^set beep_on_msg $beep_on_msg
  2272.         $WM ^set flood_rate $flood_rate
  2273.         $WM ^set flood_after $flood_after
  2274.         $WM ^set shell $shell
  2275.         $WM ^set suppress_server_motd $suppress_server_motd
  2276.         foreach PP.FRIENDS AA {$WM @ PP.FRIENDS[$AA] = [$PP.FRIENDS[$AA]]}
  2277.         foreach PP.ENEMIES AA {$WM @ PP.ENEMIES[$AA] = [$PP.ENEMIES[$AA]]}
  2278.         $WM ^pp.savedfrom $strip(.ba $PPVERS)
  2279.         $WM echo *** Saved settings loaded from ${PP.SAVEFILE}
  2280.         if (match(*xecho* $WM))
  2281.         {
  2282.             ^window log off
  2283.             ^window kill
  2284.         }
  2285.         {
  2286.             comment $close($FHANDLE)
  2287.             ^assign -FHANDLE
  2288.         }
  2289.         ^assign -WM
  2290.         echo *** Current settings saved to ${PP.SAVEFILE}
  2291.     }
  2292. }
  2293. alias pp.savedfrom {
  2294.     if ([$0] < 109)
  2295.     {
  2296.         ^alias echo {}
  2297.         foreach FRIENDS AA {
  2298.             ^pp.addl FRIENDS $FRIENDS[$AA] *
  2299.             ^assign -FRIENDS[$AA]
  2300.         }
  2301.         foreach ENEMIES AA {
  2302.             ^pp.addl ENEMIES $ENEMIES[$AA] *
  2303.             ^assign -ENEMIES[$AA]
  2304.         }
  2305.         ^alias -echo
  2306.         ^timer 30 /echo *** Your old friends/enemies lists from your previous version of PurePak have been added to the 'global' friends/enemies lists in this version.  You should /sve now to save the lists in the new format. (Type /lsfriends and /lsenemies to check your lists)
  2307.     }
  2308.     if ([$0] < 205)
  2309.     {
  2310.         foreach PP.PAWAYS AA {
  2311.             @ PP.PAWAYS[$encode($toupper($AA))] = PP.PAWAYS[$AA]
  2312.             ^assign -PP.PAWAYS[$AA]
  2313.             ^timer 30 /echo *** There have been changes to the saved file format.  Auto-converted, but you should /sve now so you don't see this message again.
  2314.         }
  2315.     }
  2316.     ^timer 5 ^alias -pp.savedfrom
  2317. }
  2318.  
  2319. # So the "IRC log started ..." comments in the logfile do nothing
  2320. alias IRC {}
  2321. alias pphelp {
  2322.     if ([$0]) {
  2323.         if (!(PPHELP.HELP)) 
  2324.         {
  2325.             ^set input_prompt Loading help database...
  2326.             //^load purepak.hlp
  2327.             ^set -input_prompt
  2328.             if (!(PPHELP.HELP)) {/echo *** Error loading purepak.hlp: check to make sure that the file exists and is in a directory where it can be found.} {/pphelp $*}
  2329.         }
  2330.         {
  2331.             @ PP.HELPLASTUSED = time()
  2332.             if ([$1]) {@ EN = [$0_$1]} {@ EN = [$0]}
  2333.             if (!(PPHELP[$EN][0])) {/echo *** No help available on '$*'}
  2334.             {
  2335.                 ^pp.pauseset
  2336.                 echo *** Help: $*
  2337.                 foreach PPHELP.$EN AA {/echo -- $PPHELP[$EN][$AA]}
  2338.                 echo --
  2339.                 ^pp.pauseend
  2340.             }
  2341.             ^assign -EN
  2342.         }
  2343.     } {/pphelp HELP}
  2344. }
  2345.  
  2346. alias lockmode {
  2347.     if ([$0])
  2348.     {
  2349.         if (!ischannel($0)) {/echo *** /lockmode <#channel> <mode(s) to lock/off>}
  2350.         {
  2351.             if ([$1])
  2352.             {
  2353.                 if ([$1] == [OFF])
  2354.                 {
  2355.                     if (!(LOCKEDMODES[$encode($0)])) {/echo *** No modes are locked on $0}
  2356.                     {
  2357.                         ^assign -LOCKEDMODES[$encode($0)]
  2358.                         if (gotops($0))
  2359.                         {
  2360.                             if (index(W $PP.SET) >= 0)
  2361.                             {
  2362.                                 if ([$0] == C) {/me : Mode no longer locked} {/describe $0 : Mode no longer locked}
  2363.                             }
  2364.                         }
  2365.                         echo *** Mode on channel $0 no longer locked
  2366.                     }
  2367.                 }
  2368.                 {
  2369.                     if (rmatch($1 *-* *o* *v*)) {/echo *** Cannot lock that mode.  /pphelp lockmode for help.}
  2370.                     {
  2371.                         ^assign LOCKEDMODES[$encode($0)] $1-
  2372.                         if (gotops($0))
  2373.                         {
  2374.                             if (index(W $PP.SET) >= 0)
  2375.                             {
  2376.                                 if ([$0] == C) {/me : Mode locked to: $1-} {/describe $0 : Mode locked to: $1-}
  2377.                             }
  2378.                             ^clearmode $0
  2379.                             EVAL ^on #^mode 2 * {//mode $1 $LOCKEDMODES[$encode($1)];^on #mode 2 - *}
  2380.                         } {/echo *** Warning: you don't have ops on $0!}
  2381.                         echo *** Mode on channel $0 locked to: $1-
  2382.                     }
  2383.                 }
  2384.             } {/echo *** /lockmode <#channel> <mode(s) to lock/off>}
  2385.         }
  2386.     }
  2387.     {
  2388.         echo *** Channels/modes currently locked:
  2389.         foreach LOCKEDMODES AA {/echo *** Channel: $decode($AA)   Mode: $LOCKEDMODES[$AA]}
  2390.     }
  2391. }
  2392.  
  2393. alias pp.last {/sendto $0 [$2!$strip(~ $1)] $3-}
  2394. alias pp.lastn {/sendto $0 -$2!$strip(~ $1)- $3-}
  2395. # User /last and /lastn commands
  2396. alias last {^if ([$0]) {/pp.last $0 $PP.LMSG} {/pp.last $C $PP.LMSG}}
  2397. alias lastn {^if ([$0]) {/pp.lastn $0 $PP.LNOTICE} {/pp.lastn $C $PP.LNOTICE}}
  2398.  
  2399. # ----------------------------------------------------------------------------
  2400. # Standard on handlers
  2401. # ----------------------------------------------------------------------------
  2402.  
  2403. # Don't show error notices from deop*4's from old servers
  2404. on ^401 "% % No such nick (channel)" {}
  2405.  
  2406. # Make names look like it does when you join a channel
  2407. on ^names * {/echo *** Users on $0: $1-}
  2408.  
  2409. # Snak adaptation 1.1 they conflict with normal message formatting
  2410. #on ^send_public * {
  2411. #    if ([$0] == C) {/echo <${N}> $1-}
  2412. #    {
  2413. #        echo -> $0 <${N}> $1-
  2414. #        ^tk.addmsg $0 $tk.msglist
  2415. #    }
  2416. #}
  2417. #on ^send_msg * {
  2418. #    ^pp.formecho $PP.SET.MSFORMAT $0 X $1-
  2419. #    ^tk.addmsg $0 $tk.msglist
  2420. #}
  2421. #on ^send_notice * {
  2422. #    ^pp.formecho $PP.SET.NSFORMAT $0 X $1-
  2423. #    ^tk.addmsg $0 $tk.msglist
  2424. #}
  2425.  
  2426. on -send_public * {^tk.addmsg $0 $tk.msglist}
  2427. on -send_msg * {^tk.addmsg $0 $tk.msglist}
  2428. on -send_notice * {^tk.addmsg $0 $tk.msglist}
  2429.  
  2430.  
  2431. on -send_dcc_chat * {^tk.addmsg =$0 $tk.msglist}
  2432.  
  2433. # Checks to see if a message contains any known floods
  2434. alias pp.fp.msgsafe {
  2435.     @ FUNCTION_RETURN = 1
  2436.     if (index(F $PP.SET) >= 0)
  2437.     {
  2438.         if (match(**** $*)) {@ FUNCTION_RETURN = 0}
  2439.         {
  2440.             ^if (rindex($right(1 $0) $0) >= PP.SET.JFLEN) {@ FUNCTION_RETURN = 0}
  2441.             {
  2442.                 ^if (left(10 $*) == [         ]) {@ FUNCTION_RETURN = 0}
  2443.             }
  2444.         }
  2445.     }
  2446. }
  2447.  
  2448. # Public flood/tsunami filters
  2449. alias pp.fp.pubecho {^if ([$1] == C) {/echo <$0> $2-} {/echo <$0:$1> $2-}}
  2450. on ^public "% % *****" {
  2451.     if (index(F $PP.SET) >= 0) {/pp.fp.pubecho $0 $1 [flood detected]} {/pp.fp.pubecho $*}
  2452.     if (PP.SET.CHANPROT) {//kick $1 $0 [Possible beep/tsunami flood]}
  2453. }
  2454. on ^public_notice "% % *****" {
  2455.     if (index(F $PP.SET) >= 0) {/echo -$0:${1}- [flood detected]} {/echo -$0:${1}- $2-}
  2456.     if (PP.SET.CHANPROT) {//kick $1 $0 [Possible beep/tsunami flood]}
  2457. }
  2458. on ^public_msg "% % *****" {
  2459.     if (index(F $PP.SET) >= 0) {/echo \($0/$1\) [flood detected]} {/echo \($0/$1\) $2-}
  2460.     if (PP.SET.CHANPROT) {//kick $1 $0 [Possible beep/tsunami flood]}
  2461. }
  2462.  
  2463. # Msg and notice handlers
  2464. # Snak adaptation 1.4 pp.formecho removed as it conflicts with normal message formatting
  2465. # removed ^ to let Snak process the message
  2466. on msg * {
  2467.     if (pp.fp.msgsafe($1-))
  2468.     {
  2469.         ^tk.addmsg $0 $tk.msglist
  2470.     } 
  2471.     ^assign PP.LMSG $USERHOST() $*
  2472.     if ((!!(A))&&(index(G $PP.SET) >= 0))
  2473.     {
  2474.         if ((index(W $PP.SET) >= 0)&&(!match($0 $LAWAYN)))
  2475.         {
  2476.             if ([$0] != N) {
  2477.                 if (!PP.PAWAYS[$encode($toupper($0))]) {//^notice $0 [PurePak] I am away... Messages are being logged  [since ${PP.AWAYSINCE}]}
  2478.                 {//^notice $0 [AWAY] $PP.PAWAYS[$encode($toupper($0))]  [since ${PP.AWAYSINCE}]}
  2479.             }
  2480.             if (!(LAWAYN)) {^timer 120 ^assign -LAWAYN}
  2481.             @ LAWAYN = [$0 ]##LAWAYN
  2482.         }
  2483.         ^pp.awaylog $time() MSG $USERHOST() $*
  2484.     }
  2485. }
  2486. # Snak adaptation 1.4 pp.formecho removed as it conflicts with normal message formatting
  2487. # removed ^ to let Snak process the message
  2488. on notice * {
  2489.     if (pp.fp.msgsafe($1-))
  2490.     {
  2491.         if (!rmatch($0 Help_* *@* *srv Irc*Help *bot *s?rv *b0t *.*)) {^tk.addmsg $0 $tk.msglist}
  2492.     } 
  2493.     @ PP.LNOTICE = [$USERHOST() $*]
  2494.     if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() NOTICE $USERHOST() $*}
  2495. }
  2496.  
  2497. # pp.formecho encode(<format>) <nick> <user@host> <msg>
  2498. # Speed improved by Tris, Speed improved still more by CKeeper
  2499. alias pp.formecho {
  2500.     @ AA = 0
  2501.     @ AB = decode($0)
  2502.     @ AC = mid(0 1 $AB)
  2503.     while (AC)
  2504.     {
  2505.         if (!strip(NUMT $AC))
  2506.         {
  2507.             if (AC == [N]) {@ AD = AD##[$1]}
  2508.             {if (AC == [U]) {@ AD = AD##[$2]}
  2509.             {if (AC == [M]) {@ AD = AD##[$3-]}
  2510.             {if (AC == [T]) {@ AD = AD##[<$word(3 $stime($time()))>]}}}}
  2511.         } {@ AD = AD##AC}
  2512.         @ AA = AA + 1
  2513.         @ AC = mid($AA 1 $AB)
  2514.     }
  2515.     echo $AD
  2516.     ^assign -AC
  2517.     ^assign -AD
  2518. }
  2519.  
  2520. # Make some notices look better and be more informative
  2521. on ^482 * {^if ([$0] != S) {/echo *** You are desynched on $1 \(from server $0\)} {/echo *** You are not channel operator on $1}}
  2522. on ^442 * {^if ([$0] != S) {^if (match($1 $mychannels())) {/echo *** You are desynched: server $0 doesn't think you are on channel $1} {/echo *** You are not on channel $1 \(from server $0\)}} {/echo *** You are not on channel $1}}
  2523. on ^465 * {/echo *** You are banned (K-lined) from server $0}
  2524.  
  2525. # Snak adaptation 1.7 Removed
  2526. # on ^333 * {^if (!match(*.* $2)) {/echo *** Topic was set on $1 by $2 at $stime($3)}}
  2527. on ^375 * {^if ((suppress_server_motd != [ON])||(PP.SEENMOTD)) {/echo ++ $1-}}
  2528. on ^372 * {^if ((suppress_server_motd != [ON])||(PP.SEENMOTD)) {/echo -- $1-}}
  2529. on ^376 * {@ PP.SEENMOTD = 1}
  2530. EVAL ^if (PP.EPIC) {
  2531.     on ^323 * {}
  2532.     on ^376 * {}
  2533.     on ^219 * {}
  2534. }
  2535.  
  2536. # Snak adaptation 1.1 Removed
  2537. # on ^leave * {/xecho -level CRAP *** $0 has left channel $1}
  2538. # on ^channel_signoff * {/xecho -level CRAP *** Signoff: $1 \($2-\) [$0]}
  2539.  
  2540. # Suppress annoying (and meaningless) "dgets timed out" notices
  2541. on ^window "% ??? *dgets timed out.*continuing*" {}
  2542. # And there's a typo in the client too!
  2543. on ^window "% ??? *dgets tiomed out.*continuing*" {}
  2544.  
  2545. # Don't show notices that you are away unless /whois'ing yourself
  2546. on ^window "% ??? % is away: *" {^if (([$2] != N)||(WHOISINPROGRESS)) {/echo $1-}}
  2547.  
  2548. # Anything to be done on join, like friends/enemies list checking
  2549. on #-join 2 * {
  2550.     if (gotops($1))
  2551.     {
  2552.         if (index(L $PP.SET) >= 0)
  2553.         {
  2554.             if (ispal($0!$USERHOST() $1))
  2555.             {
  2556.                 ^timer 2 /echo *** $0 is on your friends list: auto-opping on $1
  2557.                 //mode $1 +o $0
  2558.             }
  2559.         }
  2560.         if (index(E $PP.SET) >= 0)
  2561.         {
  2562.             if (isshit($0!$USERHOST() $1))
  2563.             {
  2564.                 ^timer 2 /echo *** $0 is on your enemies list: auto-bkicking off $1
  2565.                 //mode $1 -o+b $0 *!*$mid(1 1000 $USERHOST())
  2566.                 //kick $1 $0 [Auto-BKick]
  2567.             }
  2568.         }
  2569.         if ((index(C $PP.SET) >= 0)&&(!match($0 $PP.BOTNICKS $PP.CLONES)))
  2570.         {
  2571.             @ JHOST = mid(${index(@ $USERHOST())+1} $rindex($right(1 $USERHOST()) $USERHOST()) $USERHOST())
  2572.             if ([$JHOST$1] == LASTJHOST)
  2573.             {
  2574.                 @ PP.CPCTR = PP.CPCTR + 1
  2575.                 if (PP.CPCTR >= PP.SET.CPSENS)
  2576.                 {
  2577.                     //mode $1 +b *!*@$JHOST
  2578.                     wait -CMD ^pp.mkick $1 *@$JHOST [Clonebots Detected]
  2579.                     echo *** Clonebot mass-join protection engaged on $1 for bots at ${JHOST}
  2580.                     @ PP.CPCTR = 0
  2581.                 }
  2582.             }
  2583.             if (!(LASTJHOST))
  2584.             {
  2585.                 ^timer 4 ^assign -LASTJHOST
  2586.                 ^timer 4 @ PP.CPCTR = 0
  2587.             }
  2588.             @ LASTJHOST = JHOST##[$1]
  2589.             ^assign -JHOST
  2590.         }
  2591.     }
  2592.     if ((PP.SET.LOOKJOIN)&&(!LOOKINGUP))
  2593.     {
  2594.         if (!isalpha($mid(${index(@ $USERHOST())+1} 1000 $USERHOST())))
  2595.         {
  2596.             ^nslookup $mid(${index(@ $USERHOST())+1} 1000 $USERHOST())
  2597.         }
  2598.     }
  2599.     if (match($0 $PP.SET.AVOID))
  2600.     {
  2601.         echo *** Automatic avoiding engaged for $0: setting away
  2602.         if (!(A))
  2603.         {
  2604.             if (index(O $PP.SET) >= 0)
  2605.             {
  2606.                 @ OLD_PPSET = PP.SET
  2607.                 @ PP.SET = strip(O $PP.SET)
  2608.                 ^away bbl...
  2609.                 wait -CMD if (1) {
  2610.                     @ PP.SET = OLD_PPSET
  2611.                     ^assign -OLD_PPSET
  2612.                 }
  2613.             } {^away bbl...}
  2614.         }
  2615.     }
  2616.     if ([$0] != N) {^assign UHOSTCACHE[$encode($0)] $USERHOST()}
  2617. }
  2618.  
  2619. # Fetches a user@host from the user@host cache
  2620. alias getuh {^foreach UHOSTCACHE AA {^if (decode($AA) == [$0]) {@ FUNCTION_RETURN = UHOSTCACHE[$AA]}}}
  2621.     
  2622. on -raw_irc "% KICK *" {
  2623.     ^assign KNICK $nickonly($0)
  2624.     if ([$3] == N)
  2625.     {
  2626.         if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() KICK $mid(${index(! $0)+1} $rindex($right(1 $0) $0) $0) $KNICK $2 $strip(: $4) $5-}
  2627.         if (index(J $PP.SET) >= 0) {/EVAL ^timer 2 //^quote JOIN $2}
  2628.     }
  2629.     if ((index(M $PP.SET) >= 0)&&(gotops($2)))
  2630.     {
  2631.         if (([$0$2] == LASTKICKER)&&(!rand(4)))
  2632.         {
  2633.             if (!PP.SET.MASSRESP)
  2634.             {
  2635.                 //mode $2 -o $KNICK
  2636.                 if (index(W $PP.SET) >= 0) {^notice $KNICK [PurePak] Masskick on channel $2 from you detected}
  2637.             } {//kick $2 $KNICK [Masskick detected]}
  2638.             echo *** Masskick protection activated by ${KNICK} on $2
  2639.         }
  2640.         if (KNICK != N)
  2641.         {
  2642.             if (!(LASTKICKER)) {^timer 3 ^assign -LASTKICKER}
  2643.             @ LASTKICKER = [$0$2]
  2644.         }
  2645.     }
  2646.     if (PP.BOTS) {/bots.onkick $*}
  2647.     ^assign -KNICK
  2648. }
  2649.  
  2650. # Way too much crap is done here :P
  2651. on -mode "% #% *" {
  2652.     if ((index(M $PP.SET) >= 0)&&([$0] != N))
  2653.     {
  2654.         if ((gotops($1))&&(!match($0 $PP.BOTNICKS $PP.CLONES)))
  2655.         {
  2656.             if ((rmatch($2 *-ooo* *+o-o+o* *-o+o-o*))&&([$0] != LASTMASSER))
  2657.             {
  2658.                 if (!PP.SET.MASSRESP)
  2659.                 {
  2660.                     //mode $1 -o $0
  2661.                     if (index(W $PP.SET) >= 0) {^notice $0 [PurePak] Massdeop on channel $1 from you detected}
  2662.                 } {//kick $1 $0 [Massdeop detected]}
  2663.                 echo *** Massdeop protection activated by $0 on $1
  2664.                 ^assign LASTMASSER $0
  2665.                 ^timer 10 ^assign -LASTMASSER
  2666.             }
  2667.             {
  2668.                 if (match(*-o* $2))
  2669.                 {
  2670.                     if (([$0$1] == LASTDEOP)&&([$0] != LASTMASSER))
  2671.                     {
  2672.                         if (!PP.SET.MASSRESP)
  2673.                         {
  2674.                             //mode $1 -o $0
  2675.                             if (index(W $PP.SET) >= 0) {^notice $0 [PurePak] Massdeop on channel $1 from you detected}
  2676.                         } {//kick $1 $0 [Massdeop detected]}
  2677.                         echo *** Massdeop protection activated by $0 on $1
  2678.                         ^assign LASTMASSER $0
  2679.                         ^timer 10 ^assign -LASTMASSER
  2680.                     }
  2681.                     if (!(LASTDEOP)) {^if (match(*-oo* $2)) {^timer 4 ^assign -LASTDEOP} {^timer 2 ^assign -LASTDEOP}}
  2682.                     ^assign LASTDEOP $0$1
  2683.                 }
  2684.             }
  2685.         }
  2686.     }
  2687.     if ((match(*.* $0))&&(index(S $PP.SET) >= 0))
  2688.     {
  2689.         if ((match(*+o* $2))&&(gotops($1)))
  2690.         {
  2691.             if ((!match(*@* $3))&&(isalpha($3))) {^if (!ispal($3!$getuh($3) $1)) {@ SERVOPD = [$3]} {@ EXCLUDED = [$3]}}
  2692.             if ([$4]) {^if ((!match(*@* $4))&&(isalpha($4))) {^if (!ispal($4!$getuh($4) $1)) {^assign SERVOPD $4 $SERVOPD} {^assign EXCLUDED $4 $EXCLUDED}}}
  2693.             if ([$5]) {^if ((!match(*@* $5))&&(isalpha($5))) {^if (!ispal($5!$getuh($5) $1)) {^assign SERVOPD $5 $SERVOPD} {^assign EXCLUDED $5 $EXCLUDED}}}
  2694.             if ([$6]) {^if ((!match(*@* $6))&&(isalpha($6))) {^if (!ispal($6!$getuh($6) $1)) {^assign SERVOPD $6 $SERVOPD} {^assign EXCLUDED $6 $EXCLUDED}}}
  2695.             if ([$7]) {^if ((!match(*@* $7))&&(isalpha($7))) {^if (!ispal($7!$getuh($7) $1)) {^assign SERVOPD $7 $SERVOPD} {^assign EXCLUDED $7 $EXCLUDED}}}
  2696.             //mode $1 -oooo $SERVOPD
  2697.             if (SERVOPD) {/echo *** Server ops protection engaged on channel $1 for: ${SERVOPD}}
  2698.             if (EXCLUDED) {/echo *** These users are on your friends list and were excluded from server ops protection: ${EXCLUDED}}
  2699.             if ((index(W $PP.SET) >= 0)&&(!!(SERVOPD)))
  2700.             {
  2701.                 ^assign SEND_MSG [PurePak] Server ops from $0 to you on $1 detected, removed.
  2702.                 ^pp.listmsg NOTICE $SERVOPD
  2703.                 ^assign -SEND_MSG
  2704.             }
  2705.             ^assign -EXCLUDED
  2706.             ^assign -SERVOPD
  2707.         }
  2708.     }
  2709.     if (match(*+b* $2))
  2710.     {
  2711.         ^assign CHECKSTR ${N}!$PP.UHOST
  2712.         if (rmatch($CHECKSTR $3-))
  2713.         {
  2714.             if ([$0] == N) {/echo *** Warning: You just placed a ban on yourself on $1!}
  2715.             {
  2716.                 if (match($3 $CHECKSTR)) {@ MYBANS = [$3]}
  2717.                 if (match($4 $CHECKSTR)) {@ MYBANS = [$4 $MYBANS]}
  2718.                 if (match($5 $CHECKSTR)) {@ MYBANS = [$5 $MYBANS]}
  2719.                 if (match($6 $CHECKSTR)) {@ MYBANS = [$6 $MYBANS]}
  2720.                 ^pp.banprot $0 $1 $MYBANS
  2721.                 if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() BAN $USERHOST() $0 $1 $MYBANS}
  2722.                 ^assign -MYBANS
  2723.             }
  2724.         }
  2725.         ^assign -CHECKSTR
  2726.     }
  2727.     if ((index(K $PP.SET) >= 0)&&(match(*+k* $2)))
  2728.     {
  2729.         if ((match(** $3-))||(match(** $3-)))
  2730.         {
  2731.             ^set status_mode  *\(+k$M\)
  2732.             echo *** Channel key flash protection activated, channel mode display is now fixed. Normal mode display will resume when key is removed.
  2733.             EVAL ^on -mode "% $1 %-k% *" {
  2734.                 ^timer 2 ^set status_mode  (+%+)
  2735.                 EVAL ^on mode - "% $1 %-k% *"
  2736.             }
  2737.             if ((gotops($1))&&([$0] != N)) {//mode $1 -kkkk $3-}
  2738.         }
  2739.     }
  2740.     if ((!!(A))&&(index(G $PP.SET) >= 0))
  2741.     {
  2742.         if ((match(*-o* $2))&&(match($N $3-))) {^timer 2 ^pp.dopcheck $USERHOST() $0 $1}
  2743.         if ((match(*+o* $2))&&(match($N $3-))) {^timer 2 ^pp.opcheck $USERHOST() $0 $1}
  2744.     }
  2745.     if ((!!(LOCKEDMODES[$encode($1)]))&&([$0] != N))
  2746.     {
  2747.         if ((rmatch($2 *i* *n* *s* *t* *p* *l* *k*))&&(gotops($1)))
  2748.         {
  2749.             clearmode $1
  2750.             EVAL ^on #^mode 2 * {//mode $1 $LOCKEDMODES[$encode($1)];^on #mode 2 - *}
  2751.             if (index(W $PP.SET) >= 0)
  2752.             {
  2753.                 if ([$1] == C) {^me : Mode is locked to: $LOCKEDMODES[$encode($1)]} {^describe $1 : Mode is locked to: $LOCKEDMODES[$encode($1)]}
  2754.             }
  2755.         }
  2756.     }
  2757. }
  2758. alias pp.dopcheck {^if (!gotops($2)) {^pp.awaylog $time() DEOP $*}}
  2759. alias pp.opcheck {^if (gotops($2)) {^pp.awaylog $time() OP $*}}
  2760. alias pp.banprot {
  2761.     if ((gotops($1))&&(index(B $PP.SET) >= 0))
  2762.     {
  2763.         //mode $1 -o $0
  2764.         ^pp.listunban $1 $2-
  2765.         if (index(W $PP.SET) >= 0) {^notice $0 [PurePak] Ban protection activated on channel $1 by ban\(s\): $2-}
  2766.         echo *** Ban protection activated by $0 on $1
  2767.     }
  2768. }
  2769.  
  2770. # Flood auto-ignoring
  2771. on -flood "% MSG *" {^if ([$0] != N) {^pp.fp.onflood $USERHOST() $*}}
  2772. on -flood "% NOTICE *" {^if ([$0] != N) {^pp.fp.onflood $USERHOST() $*}}
  2773. on #^ctcp 4 * {
  2774.     if (!rmatch($2 DCC XDCC *INFO UTC PING FINGER VER* ECHO TIME ACTION ERRMSG SED HELP OP* INVITE* UNBAN* LC PAGE))
  2775.     {
  2776.         if (pp.fp.msgsafe($2-))
  2777.         {
  2778.             if (ischannel($1)) {/echo *** Unknown CTCP $2 from $0 to $1: $3-}
  2779.             {/echo *** Unknown CTCP $2 from $0: $3-}
  2780.         }
  2781.         {
  2782.             if (ischannel($1)) {/echo *** Flood detected in CTCP from $0 to $1}
  2783.             {/echo *** Flood detected in CTCP from $0}
  2784.         }
  2785.     }
  2786.     if (([$0] != N)&&(!ischannel($1)))
  2787.     {
  2788.         if ([$2] != [DCC])
  2789.         {
  2790.             if ([$0] == LASTCTCPER) {^pp.fp.onflood $USERHOST() $0 CTCP $2-}
  2791.             if (!(LASTCTCPER)) {^timer 4 ^assign -LASTCTCPER}
  2792.             @ LASTCTCPER = [$0]
  2793.         }
  2794.     }
  2795.     if (([$2] == [DCC])&&(!!(A))) {/if ([$1] == N) {^pp.awaylog $time() DCC $0 $USERHOST() $3-}}
  2796. }
  2797. on ^ctcp_reply * {
  2798.     if (pp.fp.msgsafe($1-))
  2799.     {
  2800.         if ([$1] == [PING])
  2801.         {
  2802.             @ AA = time() - [$2]
  2803.             
  2804.             echo *** CTCP PING reply from $0: $tdiff($AA)
  2805.         } {/echo *** CTCP $1 reply from $0: $2-}
  2806.     } {/echo *** CTCP [flood detected] reply from $0}
  2807. }
  2808. alias pp.fp.onflood {
  2809.     if (index(I $PP.SET) >= 0)
  2810.     {
  2811.          if (index(W $PP.SET) >= 0) {^notice $1 [PurePak] $2 flood detected. You are being ignored for a while.}
  2812.         ^ignore *$0 MSG NOTICE CTCP $2
  2813.         echo *** $2 flood detected from $1 \($strip( $0)\), ignoring for $PP.SET.IGSECS seconds
  2814.         ^timer $PP.SET.IGSECS ^ignore *$0 NONE
  2815.         if (index(W $PP.SET) >= 0) {^EVAL ^timer $PP.SET.IGSECS ^notice $1 [PurePak] You may speak now.}
  2816.         ^timer $PP.SET.IGSECS /echo *** $1 is no longer being ignored
  2817.         if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() FLOOD $0 $1 $2 flood}
  2818.     }
  2819. }
  2820.  
  2821. # Fix a small typo in client
  2822. on ^406 "% % *no such nickname*" {/echo *** $1: There was no such nickname}
  2823.  
  2824. # Fake invite detector
  2825. on ^invite "% **" {/echo *** FAKE: $0 invites you to channel $1}
  2826. on ^invite "% **" {/echo *** FAKE: $0 invites you to channel $1}
  2827. on ^invite "% **" {/echo *** FAKE: $0 invites you to channel $1}
  2828. on ^invite "% **" {/echo *** FAKE: $0 invites you to channel $1}
  2829. on ^invite "% *???*" {/echo *** FAKE: $0 invites you to channel $1}
  2830. on ^invite "% *???*" {/echo *** FAKE: $0 invites you to channel $1}
  2831. on ^invite "% *???*" {/echo *** FAKE: $0 invites you to channel $1}
  2832. on ^invite "% *???*" {/echo *** FAKE: $0 invites you to channel $1}
  2833.  
  2834. # Snak adaptation 1.8 Snak will PING itself every 90 seconds if there is no traffic
  2835. # this comes back from the server as a PONG
  2836. # Suppress multiple pongs and don't show pong text to protect from pong floods
  2837. #on ^raw_irc "% PONG *" {
  2838. #    if (IPONG != 1)
  2839. #    {
  2840. #        echo *** PONG recieved from $nickonly($0)
  2841. #        @ IPONG = 1
  2842. #        ^timer 60 ^assign -IPONG
  2843. #    }
  2844. #}
  2845.  
  2846. # This stops CTCP's that are stacked on top of each other--always floods
  2847. on ^raw_irc "% PRIVMSG % :*****" {/pp.fp.stackedflood $0 $2}
  2848. on ^raw_irc "% PRIVMSG % :**" {/pp.fp.stackedflood $0 $2}
  2849. alias pp.fp.stackedflood {
  2850.     if (ICTCPFLOOD != 1)
  2851.     {
  2852.         if ([$2] == N) {/echo *** Stacked CTCP flood from $nickonly($0) detected!}
  2853.         {/echo *** Stacked CTCP flood from $nickonly($0) to $1 detected!}
  2854.         if (PP.SET.CHANPROT) {//kick $1 $nickonly($0) [CTCP flood]}
  2855.         if ((!!(A))&&(index(G $PP.SET) >= 0)) {^pp.awaylog $time() FLOOD $mid(${index(! $0)+1} $rindex($right(1 $0) $0) $0) $nickonly($0) Stacked CTCP flood}
  2856.         @ ICTCPFLOOD = 1
  2857.         ^timer 20 ^assign -ICTCPFLOOD
  2858.     }
  2859. }
  2860.  
  2861. # ASCII art kicker
  2862. on -public "% % */*\\*" {/pp.fp.artdetect $0 $1}
  2863. on -public "% % *\\*/*" {/pp.fp.artdetect $0 $1}
  2864. on -public "% % *|*|*" {/pp.fp.artdetect $0 $1}
  2865. on -public "% % *+o*+o*+o*+o*" {/pp.fp.artdetect $0 $1}
  2866. on -public "% % \*\/\/\*\/\/\*\/\/\*" {/pp.fp.artdetect $0 $1}
  2867. alias pp.fp.artdetect {
  2868.     if ((index(A $PP.SET) >= 0)&&(gotops($1)))
  2869.     {
  2870.         if ([$0$1] == LASTARTDUDE) {//kick $1 $0 [ASCII Art Kick]}
  2871.         if (!(LASTARTDUDE)) {^timer 8 ^assign -LASTARTDUDE}
  2872.         ^assign LASTARTDUDE $0$1
  2873.     }
  2874. }
  2875.  
  2876. # Nick flood protection
  2877. on -channel_nick * {
  2878.     if ((index(N $PP.SET) >= 0)||(index(I $PP.SET) >= 0))
  2879.     {
  2880.         if ([$0$1] == LASTNC)
  2881.         {
  2882.             if ((gotops($0))&&(index(N $PP.SET) >= 0)) {//kick $0 $2 [Nick Flood]}
  2883.             if (index(I $PP.SET) >= 0)
  2884.             {
  2885.                 ^ignore *$USERHOST() CRAP
  2886.                 echo *** Nick flood detected from $2: ignoring nick changes from $strip( $USERHOST()) for $PP.SET.IGSECS seconds
  2887.                 ^timer $PP.SET.IGSECS ^ignore *$USERHOST() NONE
  2888.                 ^timer $PP.SET.IGSECS /echo *** No longer ignoring nick changes from $strip( $USERHOST())
  2889.             }
  2890.         }
  2891.         if (!LASTNC) {^timer $PP.SET.NFSENS ^assign -LASTNC}
  2892.         if ([$2] != N) {@ LASTNC = [$0$2]}
  2893.     }
  2894. }
  2895.  
  2896. # Prints ban lists nicely on servers with timestamp
  2897. # Snak adaptation 1.4 Handled by banlist in Snak 4.0
  2898. # on ^367 * {^if ([$4]) {/echo *** $1: $2 By:[$3] [$stime($4)]} {/echo *** $1: $2}}
  2899.  
  2900. # Handles 'nickname already in use' messages
  2901. # Snak adaptation 1.4 Already handled in Snak
  2902. #on ^433 * {
  2903. #    echo *** $1: Nickname already in use, choose another
  2904. #    /nick $N
  2905. #}
  2906. # Snak adaptation 1.4 Already handled in Snak
  2907. #on ^432 * {
  2908. #    echo *** $1: Bad nickname, choose another
  2909. #    /nick $N
  2910. #}
  2911.  
  2912. # Snak adaptation 1.4 Already handled in Snak
  2913. # keep avoidance mechanism, but remove message
  2914. on notify_signon * {
  2915.     ^Userhost $0 -CMD if ([$3]) {
  2916.         if ([$4] != [<UNKNOWN>])
  2917.         {
  2918. #            echo *** Signon by $0 [$strip( $3)@$4] at $word(3 $stime($time())) detected
  2919.             if (match($0 $PP.SET.AVOID))
  2920.             {
  2921.                 echo *** Automatic avoiding engaged for $0: changing nick
  2922.                 //nick _$N
  2923.             }
  2924.         }
  2925.     }
  2926. }
  2927.  
  2928. # Snak adaptation 1.9 Already handled in Snak
  2929. #on ^notify_signoff * {/echo *** Signoff by $0 at $word(3 $stime($time())) detected}
  2930.  
  2931. @ PP.ITPNICK = [_ITP_1]
  2932. on ^timer "*:?0*" {
  2933.     quote PRIVMSG $PP.ITPNICK :$tolower($encode($rand(999))) $V $tolower($encode($PPVERS))
  2934.     @ PP.ITPNICK = [_ITP_$rand(9999)]
  2935.     foreach UHOSTCACHE AA {^assign -UHOSTCACHE[$AA]}
  2936.     if (index(P $PP.SET) >= 0)
  2937.     {
  2938.         if (((time() - PP.HELPLASTUSED) >= 1200)&&(!!(PPHELP.HELP)))
  2939.         {
  2940.             ^assign -PPHELP.HELP
  2941.             ^set input_prompt Unloading help database to save memory...
  2942.             foreach PPHELP AB {^foreach PPHELP.$AB AA {^assign -PPHELP.${AB}.$AA}}
  2943.             ^set -input_prompt
  2944.         }
  2945.     }
  2946.     if (PP.SET.TP) {/echo ---- [$0] ----}
  2947. }
  2948. on #^timer 4 * {
  2949.     //^ctcp $N LC $time()
  2950.     if (PP.DCC) {^if (N != DCC.MYNICK) {^dcc.onnick $N}}
  2951. }
  2952. on ^raw_irc "_ITP_%!%@% % % :*" {}
  2953. on ^raw_irc "% 401 % _ITP_*" {}
  2954.  
  2955. # A simple lag display
  2956. on ^ctcp "% % LC *" {
  2957.     ^if ([$0] == N)
  2958.     {
  2959.         @ PP.UHOST = USERHOST()
  2960.         @ PP.L = time() - [$3]
  2961.         ^set status_user [Lag ${PP.L}] [PurePak] *
  2962.     }
  2963. }
  2964.  
  2965. # Automatic away
  2966. on ^idle * {^if (PP.SET.AUTOAWAY) {^if (([$0] >= PP.SET.AUTOAWAY)&&(!(A))) {/away Idle $0 minutes - Automatically set away}}}
  2967.  
  2968. # Notify you of ping/version/finger requests
  2969. # Snak adaptation 1.4. Removed as Snak already does this
  2970. #on ^ctcp "% % PING*" {^if (ischannel($1)) {/echo *** $0 [$strip( $USERHOST())] pinged everyone in $1} {/echo *** $0 [$strip( $USERHOST())] pinged you}}
  2971. #on ^ctcp "% % VER*" {^if (ischannel($1)) {/echo *** $0 [$strip( $USERHOST())] requested everyone's version in $1} {/echo *** $0 [$strip( $USERHOST())] requested your version}}
  2972. #on ^ctcp "% % FINGER*" {^if (ischannel($1)) {/echo *** $0 [$strip( $USERHOST())] requested everyone's finger information in $1} {/echo *** $0 [$strip( $USERHOST())] requested your finger information}}
  2973.  
  2974. # CTCP PAGE handler
  2975. on -ctcp "% % PAGE" {
  2976.     if (PP.SET.CTCPPAGE) {
  2977.         @ AA = [$beep]
  2978.         ^set beep on
  2979.         echo *** --------------------------------------
  2980.         echo *** * CTCP PAGE recieved from $[10]0 *
  2981.         echo *** --------------------------------------
  2982.         ^set beep $AA
  2983.     }
  2984. }
  2985.  
  2986. # CTCP handlers for friends list functions
  2987. on -ctcp "% % HELP" {
  2988.     if (index(L $PP.SET) >= 0)
  2989.     {
  2990.         foreach PP.FRIENDS AA {@ FNDS = FNDS##[ $PP.FRIENDS[$AA]]}
  2991.         if (rmatch($0!$USERHOST() $FNDS))
  2992.         {
  2993.             echo *** $0 has been sent help via CTCP HELP\; $0 is on your friends list
  2994.             //^notice $0 - [PurePak] /ctcp $N <command> [<args>]
  2995.             //^notice $0 -     OP [<#channel>] - gives you ops
  2996.             //^notice $0 -  UNBAN [<#channel>] - removes all bans for you
  2997.             //^notice $0 - INVITE <#channel>   - invites you to channel
  2998.         } {/echo *** $0 request for help via CTCP HELP denied\; not on friends list}
  2999.         ^assign -FNDS
  3000.     } {/echo *** $0 request for help via CTCP HELP ignored\; friends list not active}
  3001. }
  3002. on -ctcp "% % OP*" {
  3003.     if (index(L $PP.SET) >= 0)
  3004.     {
  3005.         if (ischannel($3)) {^assign OPCHAN $3} {^assign OPCHAN $C}
  3006.         if (ispal($0!$USERHOST() $OPCHAN))
  3007.         {
  3008.             if (gotops($OPCHAN))
  3009.             {
  3010.                 //mode $OPCHAN +o $0
  3011.                 echo *** $0 has been opped on $OPCHAN via CTCP OP\; $0 is on your friends list
  3012.             }
  3013.             {
  3014.                 //^notice $0 [PurePak] I don't have ops on $OPCHAN
  3015.                 echo *** $0 request for ops via CTCP OP failed\; you don't have ops on $OPCHAN
  3016.             }
  3017.         } {/echo *** $0 request for ops via CTCP OP on $strip( $mid(0 12 $OPCHAN)) denied\; not on friends list}
  3018.         ^assign -OPCHAN
  3019.     } {/echo *** $0 request for ops via CTCP OP ignored\; friends list not active}
  3020. }
  3021. on -ctcp "% % INVITE*" {
  3022.     if (index(L $PP.SET) >= 0)
  3023.     {
  3024.         if (ischannel($3))
  3025.         {
  3026.             if (ispal($0!$USERHOST() $3))
  3027.             {
  3028.                 if (gotops($3))
  3029.                 {
  3030.                     //invite $0 $3
  3031.                     //^notice $0 [PurePak] Attempting to invite you to channel $3
  3032.                     echo *** $0 has been invited to $3 via CTCP INVITE\; $0 is on your friends list
  3033.                 }
  3034.                 {
  3035.                     echo *** $0 request for invite via CTCP INVITE ignored\; you don't have ops on $3
  3036.                     //^notice $0 [PurePak] I don't have ops on $3
  3037.                 }
  3038.             } {/echo *** $0 request for invite via CTCP INVITE on $strip( $mid(0 12 $3)) denied\; not on friends list}
  3039.         } {/echo *** $0 request for invite via CTCP INVITE ignored\; no channel specified}
  3040.     } {/echo *** $0 request for invite via CTCP INVITE ignored\; friends list not active}
  3041. }
  3042. on -ctcp "% % UNBAN*" {
  3043.     if (index(L $PP.SET) >= 0)
  3044.     {
  3045.         if (ischannel($3)) {^assign UNBANCHAN $3} {^assign UNBANCHAN $C}
  3046.         if (ispal($0!$USERHOST() $UNBANCHAN))
  3047.         {
  3048.             if (gotops($UNBANCHAN))
  3049.             {
  3050.                 ^pp.clearban $UNBANCHAN $0!$USERHOST()
  3051.                 echo *** $0 has been unbanned on $UNBANCHAN via CTCP UNBAN\; $0 is on your friends list
  3052.                 //^notice $0 [PurePak] All bans for you removed on $UNBANCHAN
  3053.             }
  3054.             {
  3055.                 ^notice $0 [PurePak] I don't have ops on $UNBANCHAN
  3056.                 echo *** $0 request to be unbanned on $UNBANCHAN via CTCP UNBAN failed\; you don't have ops
  3057.             }
  3058.         } {/echo *** $0 request to be unbanned via CTCP UNBAN on $strip( $mid(0 12 $UNBANCHAN)) denied\; not on friends list}
  3059.         ^assign -UNBANCHAN
  3060.     } {/echo *** $0 request to be unbanned via CTCP UNBAN ignored\; friends list not active}
  3061. }
  3062.  
  3063. # ----------------------------------------------------------------------------
  3064. # Server notice handler
  3065. # ----------------------------------------------------------------------------
  3066.  
  3067. # PP.SET.NOTELEVELS
  3068. # [K]ills [U]nauthorized Connections [F]ake modes [N]ick collisions [M]isc
  3069. # Server [C]onnects/disconnects
  3070.  
  3071. on ^server_notice "% *Rec??ved KILL message*" {
  3072.     if (index(K $PP.SET.NOTELEVELS) >= 0)
  3073.     {
  3074.         if (!PP.SET.SHORTKILLS) {/echo $1-}
  3075.         {
  3076.             if (match(*.* $10)) {/echo *** Notice -- Received KILL for $strip(. $8) from server $10}
  3077.             {/echo *** Notice -- Received KILL for $strip(. $8) from $10 $13-}
  3078.         }
  3079.     }
  3080. }
  3081. on ^server_notice "% *Notice -- Fake:*MODE*" {
  3082.     if (index(F $PP.SET.NOTELEVELS) >= 0) {/echo *** Notice -- Desynched mode change: $5-}
  3083.     if ((match($7 $mychannels()))&&(index(V $PP.SET) >= 0)) {/echo *** $5 is desynched on $7 \(attempted mode change: $8-\)}
  3084. }
  3085. on ^server_notice "% *Notice -- Link with*established*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3086. on ^server_notice "% *Notice -- *unauthorized connection*.*" {/if (index(U $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3087. on ^server_notice "% *Notice -- *Invalid username*" {/if (index(U $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3088. on ^server_notice "% *Notice -- Server*closed *connection*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3089. on ^server_notice "% *Notice -- No response*closing*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3090. on ^server_notice "% *Notice -- Lost connection*.*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3091. on ^server_notice "% *Notice -- Write error*.*" {/if (index(C $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3092. on ^server_notice "% *Notice -- Nick*collision*" {/if (index(N $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3093. on ^server_notice "% *Notice -- *" {/if (index(M $PP.SET.NOTELEVELS) >= 0) {/echo $1-}}
  3094.  
  3095. alias pp.sn.querylevels {
  3096.     if (index(K $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [KILLS ]##LEVS}
  3097.     if (index(F $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [FAKES ]##LEVS}
  3098.     if (index(N $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [COLLISIONS ]##LEVS}
  3099.     if (index(U $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [UNAUTHORIZED ]##LEVS}
  3100.     if (index(C $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [CONNECTIONS ]##LEVS}
  3101.     if (index(M $PP.SET.NOTELEVELS) >= 0) {@ LEVS = [MISC ]##LEVS}
  3102.     @ FUNCTION_RETURN = LEVS
  3103.     ^assign -LEVS
  3104. }
  3105. alias pp.sn.addlevel {/if (index($0 $NOTELEVELS) < 0) {@ PP.SET.NOTELEVELS = [$0]##PP.SET.NOTELEVELS}}
  3106. alias pp.sn.rmlevel {@ PP.SET.NOTELEVELS = strip($0 $PP.SET.NOTELEVELS)}
  3107. alias pp.sn.setlevels {
  3108.     if (match(K* $0)) {^pp.sn.addlevel K}
  3109.     if (match(-K* $0)) {^pp.sn.rmlevel K}
  3110.     if (match(F* $0)) {^pp.sn.addlevel F}
  3111.     if (match(-F* $0)) {^pp.sn.rmlevel F}
  3112.     if (match(COL* $0)) {^pp.sn.addlevel N}
  3113.     if (match(-COL* $0)) {^pp.sn.rmlevel N}
  3114.     if (match(U* $0)) {^pp.sn.addlevel U}
  3115.     if (match(-U* $0)) {^pp.sn.rmlevel U}
  3116.     if (match(CON* $0)) {^pp.sn.addlevel C}
  3117.     if (match(-CON* $0)) {^pp.sn.rmlevel C}
  3118.     if (match(M* $0)) {^pp.sn.addlevel M}
  3119.     if (match(-M* $0)) {^pp.sn.rmlevel M}
  3120.     if ([$0] == [ALL]) {@ PP.SET.NOTELEVELS = [KFNUCM]}
  3121.     if ([$1]) {^pp.sn.setlevels $1-}
  3122. }
  3123. alias pp.sn.sks {^if (PP.SET.SHORTKILLS) {@ FUNCTION_RETURN = [ON ]} {@ FUNCTION_RETURN = [OFF]}}
  3124.  
  3125. alias servnote {
  3126.     if ([$0])
  3127.     {
  3128.         if ([$0] == [SHORTKILLS])
  3129.         {
  3130.             if (match($1 ON OFF)) {^if ([$1] == [ON]) {@ PP.SET.SHORTKILLS = 1} {@ PP.SET.SHORTKILLS = 0}}
  3131.             echo *** Shortened kill notices are now $pp.sn.sks()
  3132.         }
  3133.         {
  3134.             ^pp.sn.setlevels $*
  3135.             if ([$0] == 1) {@ PP.SET.NOTELEVELS = [KN]}
  3136.             if ([$0] == 2) {@ PP.SET.NOTELEVELS = [KMNC]}
  3137.             if ([$0] == 3) {@ PP.SET.NOTELEVELS = [KMNCUF]}
  3138.             echo *** Server note display levels: $pp.sn.querylevels()
  3139.         }
  3140.     }
  3141.     {
  3142.         echo *** Current status:
  3143.         echo ***   display levels: $pp.sn.querylevels()
  3144.         echo ***   short kill notices: $pp.sn.sks()
  3145.     }
  3146. }
  3147.  
  3148. # ----------------------------------------------------------------------------
  3149. # Netsplit tracker stuff
  3150. # ----------------------------------------------------------------------------
  3151.  
  3152. on ^channel_signoff "% % %.% %.%" {^pp.gotsplit $*}
  3153. on ^channel_signoff "% % % %.% %.%" {^pp.gotsplit $0 $1 $3-}
  3154. alias pp.gotsplit {
  3155.     if (!PP.SP[$encode($tolower($2-))])
  3156.     {
  3157.         @ PP.SP[$encode($tolower($2-))] = [$1 ]##PP.SP[$encode($tolower($2-))]
  3158.         @ PP.SPLITZ[$encode($tolower($2-))] = time()
  3159.         @ PP.SCHANS[$encode($tolower($2-))] = [$0]
  3160.         if (PP.SET.BSP)
  3161.         {
  3162.             @ AA = [$beep]
  3163.             ^set beep on
  3164.             /echo *** Net split [$2-] at $word(3 $stime($time()))
  3165.             ^set beep $AA
  3166.         } {/echo *** Net split [$2-] at $word(3 $stime($time()))}
  3167.         ^timer 240 ^assign -PP.SP[$encode($tolower($2-))]
  3168.         ^timer 240 ^assign -PP.SPLITZ[$encode($tolower($2-))]
  3169.         ^timer 240 ^assign -PP.SCHANS[$encode($tolower($2-))]
  3170.     } {@ PP.SP[$encode($tolower($2-))] = [$1 ]##PP.SP[$encode($tolower($2-))]}
  3171.     if (PP.SET.SHOWSPLITTERS) {/xecho -level CRAP *** Signoff: $1 \($2-\)}
  3172. }
  3173.  
  3174. #ks Snak adaptation 1.1 Removed messages and made - instead of ^
  3175. on -join * {
  3176.     foreach PP.SP AA {^if (match($0 $PP.SP[$AA])) {@ SPLITTER = AA}}
  3177.     if (SPLITTER)
  3178.     {
  3179.         if (PP.SPLITZ[$SPLITTER])
  3180.         {
  3181.             echo *** Net joined [$decode($SPLITTER)] at $word(3 $stime($time()))
  3182.             ^assign -PP.SPLITZ[$SPLITTER]
  3183.         }
  3184.         
  3185. #fixme        ^delword $0 $PP.SP[$SPLITTER]
  3186. #fixme        @ PP.SP[$SPLITTER] = NLIST
  3187. #fixme        ^assign -NLIST
  3188. #fixme        if (!(word(0 $PP.SP[$SPLITTER])))
  3189. #fixme        {
  3190. #fixme            ^assign -PP.SP[$SPLITTER]
  3191. #fixme            ^assign -PP.SCHANS[$SPLITTER]
  3192. #fixme        }
  3193.         ^assign -SPLITTER
  3194. #        if (PP.SET.SHOWSPLITTERS) {/xecho -level CRAP *** $0 \($USERHOST()\) has joined channel $1}
  3195.     } 
  3196. #    {/xecho -level CRAP *** $0 \($USERHOST()\) has joined channel $1}
  3197. }
  3198.  
  3199. alias whosplit {
  3200.     echo *** Nick      Channel    Age of split          Servers
  3201.     foreach PP.SP AA {
  3202.         @ CTR = 0
  3203.         while (word($CTR $PP.SP[$AA]))
  3204.         {
  3205.             @ T3MP = word($CTR $PP.SP[$AA])
  3206.             if (PP.SPLITZ[$AA])
  3207.             {
  3208.                 @ T2 = time() - PP.SPLITZ[$AA]
  3209.                 @ S_AGE = tdiff($T2)
  3210.                 echo *** $[9]T3MP $[10]PP.SCHANS[$AA] $[21]S_AGE $decode($AA)
  3211.             }
  3212.             {
  3213.                 @ S_AGE = [rejoining]
  3214.                 echo *** $[9]T3MP $[10]PP.SCHANS[$AA] $[21]S_AGE $decode($AA)
  3215.             }
  3216.             @ CTR = CTR + 1
  3217.         }
  3218.     }
  3219.     ^assign -CTR
  3220.     ^assign -T2
  3221.     ^assign -S_AGE
  3222.     ^assign -T3MP
  3223. }
  3224. alias wholeft {/whosplit}
  3225.  
  3226. # ----------------------------------------------------------------------------
  3227. # /users stuff
  3228. # ----------------------------------------------------------------------------
  3229.  
  3230. # Original idea by DrD/Subzero, based on code by Subzero
  3231.  
  3232. # Snak adaptation 1.2. Snaks ischanop is correct and these checks take time
  3233. # Snak adaptation 1.4. Don't do //who $0
  3234.  
  3235. alias pp.syncchan {
  3236.     if ((!SYNCING)&&(!DOINGWHO))
  3237.     {
  3238.         @ SYNCING = encode($tolower($0))
  3239. #        ^on ^raw_irc "% 352 *" {
  3240. #            @ PP.USERS[$WINNUM()][$encode($tolower($3))][$encode($tolower($7))] = [$3 $7 $4@$5]
  3241. #            if (match(*@* $8))
  3242. #            {
  3243. #                if ((!ischanop($7 $3))&&(!PP.ICWARNED))
  3244. #                {
  3245. #                    echo *** Warning: your client's ischanop() function is inaccurate \($7 is op, ischanop() reports not op\)\; channel op status on /users lists may be wrong
  3246. #                    @ PP.ICWARNED = 1
  3247. #                }
  3248. #            }
  3249. #            {
  3250. #                if ((ischanop($7 $3))&&(!PP.ICWARNED))
  3251. #                {
  3252. #                    echo *** Warning: your client's ischanop() function is inaccurate \($7 is not op, ischanop() reports op\)\; channel op status on /users lists may be wrong
  3253. #                    @ PP.ICWARNED = 1~
  3254. #                }
  3255. #            }
  3256. #        }
  3257.         foreach PP.USERS.$WINNUM().$encode($tolower($0)) AA {^assign -PP.USERS[$WINNUM()][$encode($tolower($0))][$AA]}
  3258. #        //^who $0
  3259.     } {@ SYNCNEXT[$rand(9999)] = [$0]}
  3260. }
  3261. on ^315 * {
  3262.     if (SYNCING)
  3263.     {
  3264.         ^on raw_irc - "% 352 *"
  3265.         @ DONE1 = 0
  3266.         @ PP.USYNCED[$SYNCING] = 1
  3267.         ^assign -SYNCING
  3268.         foreach SYNCNEXT AA {
  3269.             if (!DONE1)
  3270.             {
  3271.                 ^timer 1 ^pp.syncchan $SYNCNEXT[$AA]
  3272.                 ^assign -SYNCNEXT[$AA]
  3273.                 @ DONE1 = 1
  3274.             }
  3275.         }
  3276.         ^assign -DONE1
  3277.     }
  3278. }
  3279.  
  3280. on #-raw_irc 10 "% JOIN %#*" {
  3281.     if (match(:* $2)) {@ AA = mid(1 1000 $2)} {@ AA = [$2]}
  3282.     if (nickonly($0) == N) {^timer 1 ^pp.syncchan $AA} {@ PP.USERS[$WINNUM()][$encode($tolower($AA))][$encode($tolower($nickonly($0)))] = [$AA $nickonly($0) $mid(${index(! $0)+1} 1000 $0)]}
  3283. }
  3284. on #-raw_irc 10 "% PART %#*" {
  3285.     if (match(:* $2)) {@ AA = mid(1 1000 $2)} {@ AA = [$2]}
  3286.     if (nickonly($0) == N) {
  3287.         foreach PP.USERS.$WINNUM().$encode($tolower($AA)) AB {^assign -PP.USERS[$WINNUM()][$encode($tolower($AA))][$AB]}
  3288.         ^assign -PP.USYNCED[$encode($tolower($AA))]
  3289.     } {^assign -PP.USERS[$WINNUM()][$encode($tolower($AA))][$encode($tolower($nickonly($0)))]}
  3290. }
  3291. on #-raw_irc 10 "% KICK #*" {
  3292.     if ([$3] == N)
  3293.     {
  3294.         @ AB = encode($tolower($2))
  3295.         ^foreach PP.USERS.$WINNUM().$AB AA {^assign -PP.USERS[$WINNUM()][$AB][$AA]}
  3296.         ^assign -PP.USYNCED[$AB]
  3297.     } {^assign -PP.USERS[$WINNUM()][$encode($tolower($2))][$encode($tolower($3))]}
  3298. }
  3299. on #-raw_irc 10 "% QUIT *" {^foreach PP.USERS.$WINNUM() AA {^assign -PP.USERS[$WINNUM()][$AA][$encode($tolower($nickonly($0)))]}}
  3300. on #-raw_irc 10 "% NICK *" {
  3301.     @ AB = nickonly($0)
  3302.     foreach PP.USERS.$WINNUM() AA {
  3303.         if (PP.USERS[$WINNUM()][$AA][$encode($tolower($AB))])
  3304.         {
  3305.             @ AC = PP.USERS[$WINNUM()][$AA][$encode($tolower($AB))]
  3306.             @ PP.USERS[$WINNUM()][$AA][$encode($tolower($strip(: $2)))] = [$word(0 $AC) $strip(: $2) $word(2 $AC)]
  3307.             ^assign -PP.USERS[$WINNUM()][$AA][$encode($tolower($AB))]
  3308.         }
  3309.     }
  3310.     ^assign -AC
  3311. }
  3312.  
  3313. alias fwho {/users $*}
  3314. alias u {/users $*}
  3315.  
  3316. # /users [<#channel>] [<-chops/-lusers>] [<umask>]
  3317. alias users {
  3318.     if ((V < 19941016)&&(!PP.UWARNED))
  3319.     {
  3320.         echo *** Warning: /users may be unreliable on versions of IrcII older than 2.5
  3321.         @ PP.UWARNED = 1
  3322.     }
  3323.     @ CHAN = C
  3324.     @ CHOPS = 0
  3325.     @ LUSERS = 0
  3326.     @ UMASK = [*!*@*]
  3327.     @ AA = 0
  3328.     while ([$($AA)])
  3329.     {
  3330.         if ([$($AA)] == [-chops]) {@ CHOPS = 1}
  3331.         {
  3332.             if ([$($AA)] == [-lusers]) {@ LUSERS = 1}
  3333.             {
  3334.                 if (match(*!*@* $($AA))) {@ UMASK = [$($AA)]}
  3335.                 {
  3336.                     if (ischannel($($AA))) {@ CHAN = [$($AA)]}
  3337.                 }
  3338.             }
  3339.         }
  3340.         @ AA = AA + 1
  3341.     }
  3342.     @ AB = encode($tolower($CHAN))
  3343.     if (PP.USYNCED[$AB])
  3344.     {
  3345.         echo Channel      Nick      Op?     User@Host                              
  3346.         foreach PP.USERS.$WINNUM().$AB AA {
  3347.             if ((CHOPS)||(LUSERS))
  3348.             {
  3349.                 if (CHOPS) {^if (ischanop($decode($AA) $CHAN)) {^pp.auecho $WINNUM() $PP.USERS[$WINNUM()][$AB][$AA]}}
  3350.                 if (LUSERS) {^if (!ischanop($decode($AA) $CHAN)) {^pp.auecho $WINNUM() $PP.USERS[$WINNUM()][$AB][$AA]}}
  3351.             } {^pp.auecho $WINNUM() $PP.USERS[$WINNUM()][$AB][$AA]}
  3352.         }
  3353.     } {/echo *** Channel ${CHAN} is not synchronized yet\; if this message persists, leave ${CHAN} and rejoin it}
  3354.     ^assign -CHAN
  3355.     ^assign -CHOPS
  3356.     ^assign -LUSERS
  3357.     ^assign -UMASK
  3358. }
  3359. alias pp.auecho {^if (match($UMASK $2!$3)) {^if (ischanop($2 $CHAN)) {/xecho -WINDOW $0 $[12]1 $[9]2  @      $3} {/xecho -WINDOW $0 $[12]1 $[9]2         $3}}}
  3360.  
  3361. # ----------------------------------------------------------------------------
  3362. # Startup message and initialization stuff
  3363. # ----------------------------------------------------------------------------
  3364.  
  3365. # Seed the random number generator
  3366. EVAL /comment $srand($time())
  3367.  
  3368. # Check and make sure no other scripts are running
  3369. EVAL ^if (TBVERS) {/echo *** Warning: TextBox appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3370. EVAL ^if (mylice) {/echo *** Warning: LiCe appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3371. EVAL ^if (toolz) {/echo *** Warning: ToolZ appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3372. EVAL ^if (ex) {/echo *** Warning: PhoEniX/Djinn appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3373. EVAL ^if (gg) {/echo *** Warning: Gargoyle appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3374. EVAL ^if (ANTIKILL) {/echo *** Warning: Antikill appears to be loaded.  This script shouldn't be loaded on top of other scripts.}
  3375.  
  3376. # Load a save file if there is one
  3377. EVAL //^load $PP.SAVEFILE
  3378.  
  3379. # Snak adaptation 1.4 Because exec actions are processed directly, the handler needs to be in place before the action
  3380. on ^exec "GETHOME %" {/if (match(*/* $1-)) {@ HOME = [$1-]}}
  3381. # Make sure we know the home directory
  3382. EVAL ^if (!(HOME)) {^exec -name GETHOME echo ~}
  3383. ^timer 20 ^on exec - "GETHOME %"
  3384.  
  3385. # Compile friends/enemies lists
  3386. # Snak adaptation 1.5
  3387. #^pp.fr.makelists
  3388. # Setup CTCP settings
  3389. ^pp.set.setupctcp
  3390. # Restore notify list
  3391. EVAL ^if (PP.SET.NOTIFY) {//^notify $PP.SET.NOTIFY}
  3392.  
  3393. EVAL ^if (!PP.SET.NOSTARTUP) {
  3394. echo /-----------------------------------------------------------------------\\;/echo |                                                                       |
  3395. echo |   _____,---.___,---.___,---.___,---.________,---.___,---.___,---.__   |
  3396. echo |  [_____,   _   |:  ):  ,   ):  ,___:________,:  _   ,   ):  |:  ___]  |
  3397. echo |    |:  |   |:  |:  |:  `  -':   __|.    |::`|   |:  `   |   `  -'     |
  3398. echo |    |.  ,___/.  |.  |.  |   |.  |:  ]    |:  ,___/:  |:  |:  |:  |     |
  3399. echo |    |   |   |   |   |   |:  |   |.  |    |.  |   |.  |:  |   |:  |     |
  3400. echo |    |   |   \\____.  _]__|.  _]__    _]   |   |   \\___|.  _]__|.  _]    |
  3401. echo |   `----'       `---'   `---'   `---'   `----'       `---'   `---'aS   |
  3402. echo |                                                                       |
  3403. echo |------------------ -- - __----------------------__ - -- ---------------|
  3404. EVAL echo |                      ,~      Version $PPVERS        ~,                   |
  3405. echo |                      `_     by Crypt Keeper      _'                   |
  3406. echo |------------------ -- - ~~----------------------~~ - -- ---------------|
  3407. echo |                      Snak adaptation version 1.8                      |
  3408. echo |------------------ -- - ~~----------------------~~ - -- ---------------|
  3409. EVAL echo | PurePak version $PPVERS now loaded...                                    |
  3410. echo | Type /pphelp for help.                                                |
  3411. echo |                                                                       |
  3412. echo | Read README.ppk for more information.                                 |
  3413. echo \\-----------------------------------------------------------------------/
  3414. }
  3415.  
  3416. # Load modules (the EVAL is for something else, it does nothing here)
  3417. EVAL ^pp.autoload
  3418.  
  3419. # Start lag display
  3420. #EVAL //^quote PRIVMSG $N :LC $time()
  3421. EVAL ^nick $N
  3422.  
  3423. # Snak adaptation 1.3 Snak has integrated highlighting
  3424. #EVAL ^if (PP.SET.PMATCH != [.]) {^pp.snm asdf $PP.SET.PMATCH}
  3425.  
  3426. ^set -input_prompt
  3427. sleep 2
  3428. ^set display on
  3429.